h={}
for _ in range(input()):
    a,b=raw_input().split()
    if a[0]=="f":
        print "yes" if b in h else "no"
    else:
        h[b]=1 h={} h {} for _ in range(input()):
    a,b=raw_input().split()
    if a[0]=="f":
        print "yes" if b in h else "no"
    else:
        h[b]=1 _ range(input()) range input() input a,b=raw_input().split() a raw_input().split() ().split () raw_input split b if a[0]=="f":
        print "yes" if b in h else "no"
    else:
        h[b]=1 a[0]=="f" a[0] a 0 "f" print "yes" if b in h else "no" b in h b h "yes" "no" h[b]=1 h[b] h b 1 a,b=raw_input().split() raw_input().split() a h={} {} h b=raw_input().split() raw_input().split() b
h={}
for _ in range(input()):
    a,b=raw_input().split()
    if a[0]=="f":
        print "yes" if b in h else "no"
    else:
        h[b]=1