5 10 20 10 30 20 4 10 20 30 40
1 2 4 -1
import sys
lines=sys.stdin.read().splitlines()
if len(lines)<3:
sys.exit(0)
n=int(lines[0].strip())
a=list(map(int,lines[1].split()[:n]))
mp={}
for i,v in enumerate(a, start=1):
if v not in mp:
mp[v]=i
q=int(lines[2].strip())
out=[]
for i in range(q):
v=int((lines[3+i] if 3+i<len(lines) else '0').strip())
out.append(str(mp.get(v,-1)))
sys.stdout.write('\
'.join(out))
import sys
lines=sys.stdin.read().splitlines()
if len(lines)<3:
sys.exit(0)
n=int(lines[0].strip())
a=list(map(int,lines[1].split()[:n]))
mp={}
for i,v in enumerate(a, start=1):
if v not in mp:
mp[v]=i
q=int(lines[2].strip())
out=[]
for i in range(q):
v=int((lines[3+i] if 3+i<len(lines) else '0').strip())
out.append(str(mp.get(v,-1)))
sys.stdout.write('\
'.join(out))