Problem:
Search III Your task is to write a program of a simple dictionary which implements the following instructions:  insert str : insert a string str in to the dictionary  find str : if the distionary contains str , then print ' yes ', otherwise print ' no '  Input In the first line n , the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format. Output Print yes or no for each find instruction in a line. Constraints  A string consists of ' A ', ' C ', ' G ', or ' T '  1 ≤ length of a string ≤ 12   n ≤ 1000000  Sample Input 1 5
insert A
insert T
insert C
find G
find A Sample Output 1 no
yes Sample Input 2 13
insert AAA
insert AAC
insert AGA
insert AGG
insert TTT
find AAA
find CCC
find CCC
insert CCC
find CCC
insert T
find TTT
find T Sample Output 2 yes
no
no
yes
yes
yes Notes Template in C

Solution (Python):
num_s, *D,  = [s.split() for s in open(0)]
num_s = int(num_s[0])
dic = {}

for d in D:
    if d[0] == "insert":
        dic[d[1]] = 1
    else:
        if d[1] in dic:
            print("yes")
        else:
            print("no")

Solution (Python):
hash_table = {}
n = int(input())
for _ in range(n):
    order, text = input().split()
    if order == "insert":
        hash_table[text] = 1
    elif order == "find":
        print("yes" if text in hash_table else "no")

Solution (Python):
if __name__ == '__main__':
	n = int(input())

	dictionary = set()

	for i in range(n):
		Command, Key = input().split()
		if Command == "insert":
			dictionary.add(Key)
		else:
			if Key in dictionary:
				print("yes")
			else:
                            print("no")

Solution (Python):
"""
hash法を構成する
"""
class Dictionary():
    def __init__(self):
        self.MEMO = {'A':1, 'G':2, 'C':3, 'T':4}
        SIZE = 13
        POW = [1]*SIZE 
        for i in range(1, 13):
            POW[i] = POW[i-1]*4
        self.POW = POW
        self.DICT = [False]*POW[12]
    
    def makekey(self, value):
        l = len(value)
        key = -1 
        for i in range(l):
            key += self.MEMO[value[i]]*self.POW[i]
        return key 
    
    def insert(self, value):
        key = self.makekey(value)
        self.DICT[key] = True
    
    def find(self, value): 
        key = self.makekey(value)
        if self.DICT[key] == False: 
            print('no')
        else:
            print('yes')

n = int(input())

d = Dictionary() 

for i in range(n):
    command, tmp_str = map(str, input().split())
    if command[0] == "i":
        d.insert(tmp_str)
    else:
        d.find(tmp_str)

Solution (Python):
d = set()
n = int(input())
for i in range(n):
    order, s = input().split(" ")
    if order == 'insert':
        d.add(s)

    elif order == 'find':
        if s in d:
            print('yes')
        else:
            print('no')

Solution (Python):
import sys

d = {'A': 0, 'C': 1, 'G': 2, 'T': 3}

the_hash = [None for _ in 'ACGT']

def insert(s):
    h = the_hash
    for c in s:
        if h[d[c]] is None:
            h[d[c]] = [None, None, None, None, False]
        h = h[d[c]]
    h[4] = True

def find(s):
    h = the_hash
    for c in s:
        if h[d[c]] is None:
            return False
        else:
            h = h[d[c]]
    else:
        return h[4]

n = int(input())
for _ in range(n):
    command, s = sys.stdin.readline().split()
    if command[0] == 'i':    
        insert(s)
    elif find(s):   
        print('yes')
    else:
        print('no')

Solution (Python):

dict = set()
n = int(input())
for i in range(n):
    line = input().split()
    if line[0] == "insert":
        dict.add(line[1])
    elif line[0] == "find":
        if line[1] in dict:
            print("yes")
        else:
            print("no")

Solution (Python):

n = int(input())
cmds = [input().split() for _ in range(n)]
dictionary = {}
for cmd in cmds:
    if cmd[0] == "insert":
        dictionary[cmd[1]] = None
    elif cmd[0] == "find":
        if cmd[1] in dictionary.keys():
            print("yes")
        else:
            print("no")

Solution (Python):
n=int(input())
d={}
for i in range(n):
    key,value=input().split()
    if key=="insert":
        d[value]=1
    else:
        if value in d:
            print("yes")
        else:
            print("no")

Solution (Python):
n = int(input())

str_dict = {}
for _ in range(0, n):
    command, str = input().split(' ')
    if command == 'insert':
        str_dict[str] = True
    elif command == 'find':
        if str in str_dict:
            print('yes')
        else:
            print('no')

Solution (Python):
import sys

def m():
    d={}
    input()
    for e in sys.stdin:
        if'f'==e[0]:
            print('yes' if e[5:] in d else 'no')
        else:
            d[e[7:]] = 0
            
if'__main__'==__name__:
    m()

Solution (Python):
n = int(input())

Dic = {}

ans = "no"

for i in range(n):
  order, word = input().split()
  if order == "insert":
    Dic[word] = i
  else:
    if word in Dic.keys():
      ans = "yes"
    else:
      ans = "no"
    print(ans)

Solution (Python):
n=int(input())
a={}
res=[]
for i in range(n):
    order, value =input().split()
    if order == 'insert':
        a[value]= i
    elif order =='find':
        if a.__contains__(value):
            print('yes')
        else:
            print('no')

Solution (Python):
import sys
from sys import stdin
input = stdin.readline

dic = {}
n = int(input())
for i in range(n):
	s = input()
	if s[0] == 'i': dic[s[7:]] = 1
	else: print("yes" if s[5:] in dic else "no")

Solution (Python):
if __name__ == '__main__':
    res = set()
    n_order = int(input())
    for i in range(n_order):
        order = input().split()
        if 'insert' == order[0]: 
            res.add(order[1])
        elif 'find' == order[0]:
            if order[1] in res: print('yes')
            else : print('no')

Solution (Python):
n = int(input())
st =set()
order, str = "",""
res = []
for i in range(n):
    order, str = input().split()
    if order == "insert":
        st.add(str)
    else:
        if str in st:print("yes")
        else:print("no")

Solution (Python):
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(3**12)

SIZE = 13
POW = [1]*SIZE

for i in range(1,SIZE):
    POW[i] = POW[i-1]*4

N = int(input())
memo = {'A':1,'G':2,'C':3,'T':4}
DICT = [False]*POW[12]

def getNUM(tmp_str):
    global POW,memo
    ret = -1
    for i in range(len(tmp_str)):
        ret += memo[tmp_str[i]]*POW[i]
    return ret


for _ in range(N):
    command,tmp_str = map(str,input().split())
    if command[0] == 'i':
        DICT[getNUM(tmp_str)] = True
    else:
        if DICT[getNUM(tmp_str)]:
            print("yes")
        else:
            print("no")

Solution (Python):




class HashTable:
    def __init__(self):
        self.Max = 1046527
        self.hashTable = [""] * self.Max
        
    def getChar(self, ch):
        if ch == "A":
            return 1
        elif ch == "G":
            return 2
        elif ch == "C":
            return 3
        elif ch == "T":
            return 4
        else:
            return 0
    
    def getKey(self, str):
        charList = list(str)
        sum = 0
        p = 1
        for ch in charList:
            sum += p * self.getChar(ch)
            p *= 5
        return sum

    def hash1(self, key):
        return key % self.Max
        
    def hash2(self, key):
        return key % (self.Max - 1)

    def find(self, str):
        key = self.getKey(str)
        i = 0
        while True:
            h = (self.hash1(key) + i * self.hash2(key)) % self.Max
            if str == self.hashTable[h]:
                return True
            elif len(self.hashTable[h]) == 0:
                return False
            i += 1
        return False

    def insert(self, str):
        key = self.getKey(str)
        i = 0
        while True:
            h = (self.hash1(key) + i * self.hash2(key)) % self.Max
            if str == self.hashTable[h]:
                return True
            elif len(self.hashTable[h]) == 0:
                self.hashTable[h] = str
                return False
            i += 1
        return False
        

hTable = HashTable()

lenA = int(input())
A = []
for i in range(lenA):
    tmp = list(input().split())
    A.append(tmp)

for i in range(lenA):
    if A[i][0] == "insert":
        hTable.insert(A[i][1])
    elif A[i][0] == "find":
        if hTable.find(A[i][1]):
            print("yes")
        else:
            print("no")

Solution (Python):
coms = ['insert', 'find']
_, *D = open(0).read().split()
S = set()
for c, s in zip(*[iter(D)]*2):
    if coms.index(c) == 0:
        S.add(s)
    else:
        print('yes' if s in S else 'no')

Solution (Python):
if __name__ == '__main__':
    n = int(input())
    worddict = {}
    for _ in range(n):
        common, word = input().split(' ')
        if common == 'insert':
            worddict[word] = 1
        else:
            if word in worddict:
                print('yes')
            else:
                print('no')

Solution (Python):
import sys
  
dic = {}

stdin = sys.stdin
n = int(stdin.readline())

for _ in range(n):
    command, c = stdin.readline().split()
    if command == 'insert':
        dic[c] = 1
    elif command == 'find':
        if c in dic:
            sys.stdout.write('yes\n')
        else:
            sys.stdout.write('no\n')

sys.stdout.flush()

Solution (Python):
from collections import deque
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    n=int(input())
    d=set()
    for _ in range(n):
        o,w=input().split()
        if o=="insert":d.add(w)
        else:
            if w in d:
                print("yes")
            else:
                print("no")

main()

Solution (Python):
dic = {}
n = int (input())
for i in range(n):
    cmd, w = input().split()
    if cmd == "insert":
        dic[w]=1
    elif cmd == "find":
        if w in dic.keys():
            print("yes")
        else:
            print("no")

Solution (Python):


D = dict()
n = int(input())
for i in range(n):
    S = input().split()
    if S[0] == 'insert':
        D[S[1]] = True
    else:
        if S[1] in D:
            print('yes')
        else:
            print('no')

Solution (Python):
n = int(input())
dic = set()

for _ in range(n):
    command, l = input().split()
    
    if command == "insert":
        dic.add(l)
    elif command == "find":
        if l in dic:
            print("yes")
        else:
            print("no")

Solution (Python):
def main():
	n = int(input())
	dic = {}
	for _ in range(n):
		s = input()
		if s[0] == "i":
			dic[s[7:]] = 0
		else:
			if s[5:] in dic:
				print("yes")
			else:
				print("no")
main()

Solution (Python):
n = int(input())
d = {}

for i in range(n):
    cmd = input().split()
    if cmd[0] == 'insert':
        d[cmd[1]] = i
    else:
        if cmd[1] in d:
            print('yes')
        else:
            print('no')

Solution (Python):
n=int(input())
dic={}
for i in range(n):
    o=input()
    if o[0]=='i':
        dic[o[7:]]=1
    else:
        print('yes' if o[5:] in dic else 'no')

Solution (Python):
n = int(input())
hashMap = {}
for i in range(n):
    inputL = input().split()
    if inputL[0] == 'insert':
        hashMap[inputL[1]] = 1
    else:
        if inputL[1] in hashMap:
            print("yes")
        else:
            print("no")

Solution (Python):
n = int(input())
list = {}
for i in range(n):
	command, item = input().split()
	if command == "find":
		if item in list:
			print("yes")
		else:
			print("no")
	else:
		list[item] = 0

Solution (Python):
dic ={}


n = int(input())

for _ in range(n):
    com, word = input().split()
    
    if com =="insert":
        dic[word] = True
    elif com =='find':
        print("yes" if word in dic else "no")

Solution (Python):


"""
Created on Thu Oct 24 00:11:24 2019

@author: iwao_yuuki
"""

import math

n = int(input(""))

D = {}
Ans = []

for i in range(n):
    cm,text = input().split()

    if cm == "insert":
        D[text] = 1
    if cm == "find":
        if text in D.keys():
                Ans.append("yes")
        else:
            Ans.append("no")

for i in Ans:
    print(i)

Solution (Python):
n=int(input())

l={}
ans=[]

for i in range(n):
    ope,let=input().split()

    if ope=='insert':
        l[let]=0
    else:
        if let in l:
            ans.append("yes")
        else:
            ans.append("no")

for h in ans:
    print(h)

Solution (Python):
n=int(input())
s=set()
for _ in range(n):
    c,t=input().split()
    if c=="insert": s.add(t)
    else: print("yes" if t in s else "no")

Solution (Python):
n= int(input())
a = set()
s = [input().split() for i in range(n)]
for i in s:
    if i[0] == "insert":
        a.add(i[1])
    else:
        if i[1] in a:
            print("yes")
        else:
            print("no")

Solution (Python):
d = set()
ans = []

for i in range(int(input())):
    str1, str2 = input().split()
    if (str1 == 'insert'):
        d.add(str2)
    else :
        if(str2 in d):
            ans.append('yes')
        else:
            ans.append('no')

for i in ans:
    print(i)

Solution (Python):


n = int(input())
dic = set()
count = 0
for i in range(n):
    s = input().split()
    if s[0] == "insert":
        dic.add(s[1])
    else:
        if s[1] in dic:
            print("yes")
        else:
            print("no")

Solution (Python):
n=int(input())
dic={}
j=0
for i in range(n):
    order,str=input().split()
    if order=="insert":
        j+=1
        dic.setdefault(str,j)
    else:
        if str in dic.keys():
            print("yes")
        else:
            print("no")

Solution (Python):
dict={}
n=int(input())
cnt=0
ans=[]
for i in range(n):
    str=list(input().split())
    if str[0]=='insert':
        dict[str[1]]=cnt
        cnt+=1

    if str[0]=='find':
        if str[1] in dict:
            print("yes")
        else:
            print("no")

Solution (Python):
if __name__ == '__main__':
    record = set()
    n = int(input())
    for _ in range(n):
        order, string = input().split()
        if order == 'insert':
            record.add(string)
        else:
            assert order == 'find', '输入错误'
            if string in record:
                print('yes')
            else:
                print('no')

Solution (Python):



n = int(input())
dic = set()

for i in range (n):
    com = input().split()

    

    if com[0] == "insert":
        dic.add(com[1])

    else:
        if com[1] in dic:
            print("yes")
        else:
            print("no")

Solution (Python):
n = int(input())
d = set()

for _ in range(n):
	command, value = input().split()

	if command == "find":
		s = "yes" if value in d else "no"
		print(s)
		continue

	d.add(value)

Solution (Python):
n=int(input())
key=set()
j=0
c=0
for i in range(n):
    a,b=input().split()
    if a=='insert':
        key.add(b)
        j=j+1
    if a=='find':
        c=0
        if b in key:
            print("yes")
        else: print("no")

Solution (Python):
n = int(input())

set1 = set()
set2 = set()

str = list()

for i in range(0, n):
    str1,str2 = input().split()
    if str1[0] == 'i':
        set1.add(str2)
    if str1[0] == 'f':
        set2.add(str2)
        set3 = set1 & set2
        if set3 == set():
            str.append('no')
        else:
            str.append('yes')
        set2.clear()

for i in range(0, len(str)):
    print(str[i])

Solution (Python):
dict = {}
n = int(input())
cnt = 0
ans = []
for i in range(n):
    str = list(input().split())
    if str[0] == 'insert':
        dict[str[1]] = cnt
        cnt += 1
    
    if str[0] == 'find':
        if str[1] in dict:
            print("yes")
        else:
            print("no")

Solution (Python):
n=int(input())
dic=set()

for i in range (n):
    s,a=input().split()
    if s=="insert":
        dic.add(a)
    elif s=="find":
        if a in dic:
            print("yes")
        else:
            print("no")

Solution (Python):
n=int(input())

s=set()
command=[]

for i in range(n):
  c=input().split()
  command.append(c)


for i in range(n):

  if command[i][0]=="insert":
    s.add(command[i][1])
  else:
    if command[i][1] in s:
      print("yes")
    else:
      print("no")

Solution (Python):
element_count = int(input())
dic = set()
for i in range(element_count):
    instruction = input().split()
    if instruction[0]=="insert":
        dic.add(instruction[1])
    elif instruction[0]=="find":
        if instruction[1] in dic:
            print("yes")
        else:
            print("no")

Solution (Python):
num = int(input())

count = 0
dict1 = {}
for i in range(num):
    command, word = map(str,input().split())
    
    if command == "insert":
        dict1[word] = i
    
    else:
        if (word in dict1.keys()) == True:
            print("yes")
        else:
            print("no")

Solution (Python):
n=int(input())
dict ={}
for i in range(n):
    c=input()
    if c[:6]=="insert":
        dict[(c[7:])]=True
    elif c[:4]=="find":
        if dict.get(c[5:])==True:
            print("yes")
        else:
            print("no")

Solution (Python):
A=set()
n=int(input())

Ans=set()
for i in range(n):    
    command,x=input().split()
    if command == "insert":
        A.add(x)
    elif command == "find":
        
        if x in A:
            print("yes")
        else:
            print("no")

Solution (Python):
a={}
n=int(input())
for i in range(n):
    s=list(input().split())
    if s[0]=='insert':
        a[s[1]]=0
    elif s[0]=='find':
        if s[1] in a:
            print('yes')
        else:
            print('no')

Solution (Python):
n = int(input())
dic = set()
for i in range(n):
    key, value = input().split()
    if key == "insert":
        dic.add(value)
    else:
        if value in dic:
            print("yes")
        else:
            print("no")

Solution (Python):
d = {}
n = int(input())
for _ in range(n):
    s = input().split()
    if s[0] == "insert":
        d[s[1]] = 0
    elif s[0] == "find":
        if d.get(s[1]) == 0:
            print("yes")
        else:
            print("no")

Solution (Python):
def main():
    d = set()
    N = int(input())
    for i in range(N):
        S = input().split()
        if S[0] == 'insert':
            d.add(S[1])
        elif S[0] == 'find':
            if S[1] in d:
                print("yes")
            else:
                print("no")

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
dic = {}
for _ in range(n):
    instruction, str = input().split()
    if instruction == 'insert':
        dic[str] = '_'
    
    else:
        if str in dic:
            print('yes')
        else:
            print('no')

Solution (Python):
n = int(input())
o = [input().split(" ") for _ in range(n)]

def func(n, o):
    dic = {}
    for i in range(n):
        if o[i][0] == "insert":
            dic[o[i][1]] = 1
        else:
            print("yes" if o[i][1] in dic else "no")

func(n, o)

Solution (Python):
n = int(input())
x = {}
for i in range(n):
    a = input().split()
    if a[0] == 'insert':
        x[a[1]] = 1
    else:
        if a[1] in x.keys():
            print('yes')
        else:
            print('no')

Solution (Python):
if __name__ == "__main__":
	d = {}
	n = int(input())
	for _ in range(n):
		command = input().split()
		if command[0] == "insert":
			d[command[1]] = ''
		if command[0] == "find":
			if command[1] in d:
				print("yes")
			else:
				print("no")

Solution (Python):
dic = {}
n = int(input())
for i in range(n):
	s = input()
	if s[0] == 'i': dic[s[7:]] = 1
	else: print("yes" if s[5:] in dic else "no")

Solution (Python):
import sys
from sys import stdin
input = stdin.readline

n = int(input())

st = set()

for _ in range(n):
    command = input()
    if command[0] == "i":
        st.add(command[7:])
    else:
        if command[5:] in st:
            print("yes")
        else:
            print("no")

Solution (Python):

n=int(input())
dic=set()
for i in range(n):
    meirei,string=input().split()
    suuzi=string.replace("A","1").replace("C","2").replace("G","3").replace("T","4")
    num=int(suuzi)

    if meirei=="insert":
        dic.add(num)
    elif meirei=="find":
        if num in dic:
            print("yes")
        else:
            print("no")

Solution (Python):
n = int(input())
S = []
for _ in range(n):
    cmd, s = input().split()
    S.append((cmd, s))
    

D = {}
for cmd, s in S:
    if cmd == 'insert':
        D[s] = True
    if cmd == 'find':
        if s in D:
            print('yes')
        else:
            print('no')

Solution (Python):

import sys
M = 1046527


def h1(key):
    return key % M


def h2(key):
    return 1 + (key % (M - 1))


def h(key, i):
    return(h1(key) + i * h2(key)) % M


def getChar(gene):
    if gene == 'A':
        return 1
    elif gene == 'C':
        return 2
    elif gene == 'G':
        return 3
    else:
        return 4


def getkey(gene):
    sum = 0
    p = 1
    for i in gene:
        sum += p * getChar(i)
        p *= 5
    return sum


class HashDict:
    def __init__(self):
        self.key = [None] * (2 * 10 ** 6)

    def insert(self, key):
        i = 0
        while True:
            j = h(key, i)
            if self.key[j] is None:
                self.key[j] = key
                return
            else:
                i += 1

    def find(self, key):
        i = 0
        while True:
            j = h(key, i)
            
            if self.key[j] == key:
                return True
            elif self.key[j] is None or i > M:
                return None
            else:
                i += 1


n = int(input())
T = HashDict()

for i in range(n):
    command, key = sys.stdin.readline().strip().split()
    key = getkey(key)
    
    if command == 'insert':
        T.insert(key)
    elif command == 'find':
        if T.find(key):
            print('yes')
        else:
            print('no')

Solution (Python):
dic={}
for i in range(int(input())):
    command,key=input().split()
    if command=="insert":
        dic[key]=True
    else:
        print("yes" if key in dic else "no")

Solution (Python):
def str2int(s):
    i=0
    for c in s:
        i*=5
        if c=='A':
            i+=1
        elif c=='C':
            i+=2
        elif c=='G':
            i+=3
        elif c=='T':
            i+=4
    return i

n=int(input())
l=set()
for i in range(n):
    S=list(input().split())
    k=str2int(S[1])
    if S[0]=='insert':
        l.add(k)
    else:
        print ('yes' if k in l else 'no')

Solution (Python):
dic = set()
for i in range(int(input())):
    command = input().split()
    if command[0] == 'insert': dic.add(command[1])
    else:
        if command[1] in dic: print('yes')
        else: print('no')

Solution (Python):
import sys
j={}
s=int(input())

for i in range(s):
  x,y=input().split()
  if x=='insert':
    j[y]=1
  elif x=='find':
    if y in j:
      print('yes')
    else:
      print('no')

Solution (Python):

def h1(key):
    return key%m

def h2(key):
    return 1+(key%(m-1))

def h(key,i):
    return (h1(key)+i*h2(key))%m

def insert(t,key):
    i=0
    while True:
        j=h(key,i)
        if t[j]==-1:
            t[j]=key
            return j
        else:
            i+=1

def search(t,key):
    i=0
    while True:
        j=h(key,i)
        if t[j]==key:
            return j
        elif t[j]==-1 or i>=m:
            return -1
        else:
            i+=1

def change(c):
    ans=""
    for i in range(len(c)):
        if c[i]=="A":
            ans+="1"
        if c[i]=="C":
            ans+="2"
        if c[i]=="G":
            ans+="3"
        if c[i]=="T":
            ans+="4"
    return int(ans)

m=1046527
n=int(input())
dict=[-1]*m
import sys
input=sys.stdin.readline
for _ in range(n):
    l=list(input().split())
    k=change(l[1])
    if l[0]=="insert":
        insert(dict,k)
    else:
        if search(dict,k)!=-1:
            print("yes")
        else:
            print("no")

Solution (Python):
import sys

dic = {}

n = int(input())
for _ in range(n):
    c, k = input().split()
    if c[0] == "i":
        dic[k] = True
    else:
        if k in dic.keys():
            sys.stdout.write("yes\n")
        else:
            sys.stdout.write("no\n")

Solution (Python):
import sys
from collections import deque

def convert_a_to_i(char):

	if char == 'A':
		return 1

	elif char == 'C':
		return 2

	elif char == 'G':
		return 3

	else:
		return 4

def hash_calc(word):

	hash = 0
	p = 1
	for i in range(len(word)):

		hash += convert_a_to_i(word[i]) * p
		p *= 5

	return hash

def find(dictionary,word):

	if dictionary[hash_calc(word)-1] == 1:
		return True
	else:
		return False

def insert(dictionary,word):

	dictionary[hash_calc(word)-1] = 1

def test():

	n = int(sys.stdin.readline())

	dictionary = [0] * (4 * 4 * 4 * 4 * 4 * 4 * 4 * 4 * 4 * 4 * 4 * 4)


	for i in range(n):

		operation = list(sys.stdin.readline().split())

		if operation[0] == 'insert':

			insert(dictionary,operation[1])
		else:

			result = find(dictionary,operation[1])
			if result == True:
				print("yes")


			else:
				print("no")




if __name__ == "__main__":
	test()

Solution (Python):
import sys

n = int(input())
dict = {}

for i in sys.stdin:
    if i[0] == 'i':
        dict[i[7:]] = 0
    else:
        print('yes' if i[5:] in dict else 'no')

Solution (Python):
n = int(input())

dictionary = dict()

for _ in range(n):
    command, value = input().split()
    if command == "insert":
        dictionary[value] = 1
    else:
        if value in dictionary:
            print("yes")
        else:
            print("no")

Solution (Python):
n = int(input())

d = {}
for i in range(n):
    q, t = input().split()
    if q == "insert":
        d[t] = 1
    if q == "find":
        if t in d:
            print("yes")
        else:
            print("no")

Solution (Python):
import sys

def conv(s):
    patterns = [["A", "1"], ["C", "2"], ["G", "3"], ["T", "4"]]
    for i, j in patterns:
        s = s.replace(i, j)
    return int(s)

MAX_PAT = pow(4,12)

def h1(val):
    return val % MAX_PAT
    
def h2(val):
    return 1 + val % (MAX_PAT-1)

def h(val, i):
    return (h1(val) + i*h2(val)) % MAX_PAT

def insert(val, arr):
    i = 0
    while True:
        idx = h(val, i)
        if arr[idx] == "NIL":
            arr[idx] = val
            return idx
        else:
            i += 1

def find(val, arr):
    i = 0
    while True:
        idx = h(val, i)
        if arr[idx] == val:
            return True
        elif (arr[idx]=="NIL")|(i>=MAX_PAT):
            return False
        else:
            i += 1
    return

dictionary = ["NIL" for i in range(MAX_PAT)]
n = int(input())
for i in range(n):
    cmd, val = sys.stdin.readline().split()

    val = conv(val)
    if cmd == "insert":
        if not find(val, dictionary):
            insert(val, dictionary)
    if cmd == "find":
        if find(val, dictionary):
            print("yes")
        else:
            print("no")

Solution (Python):
import sys
from sys import stdin
input = stdin.readline
 
dic = {}
n = int(input())
for i in range(n):
    s = input()
    if s[0] == 'i': dic[s[7:]] = 1
    else: print("yes" if s[5:] in dic else "no")

Solution (Python):
d={}
for _ in range(int(input())):
    a,b=input().split()
    if a=='find':
        if b in d:print('yes')
        else:print('no')
    else:d[b]=0

Solution (Python):
n = int(input())

d = dict()

for i in range(n):
  p, s = input().split()
  if p == "insert":
    d[s] = d.get(s, 0) + 1
  elif p == "find":
    if s in d:
      print("yes")
    else:
      print("no")

Solution (Python):
def main():
    n = int(input())

    dic = {}
    for _ in range(n):
        command = input().split(" ")
        value = command[1]
        if command[0] == 'insert':
            if value not in dic:
                dic[value] = 0
        elif command[0] == 'find':
            if value in dic:
                print('yes')
            else:
                print('no')
    return

if __name__ == '__main__':
    main()

Solution (Python):
def solve():
  N = int(input())
  dic = {}
  for _ in range(N):
    command, s = input().split()
    if command == 'insert':
      dic[s] = 1
    elif command == 'find':
      print('yes' if s in dic else 'no')
      
solve()

Solution (Python):
n = int(input())
C = []
for i in range(n):
    cmd, str = input().split()
    C.append([cmd, str])

def Dictionary(C):
    D = {}
    for i in range(n):
        if C[i][0] == 'insert':
            D[C[i][1]] = i
        else:
            if C[i][1] in D: 
                print("yes")
            else:
                print("no")
Dictionary(C)

Solution (Python):



n = int(input())

strings = set()
for i in range(n):
    order, string = input().split()
    
    if order == 'insert':
        strings.add(string)
    else:
        if string in strings:
          print('yes')
        else :
          print('no')

Solution (Python):
import sys

class HashTable:
    def __init__(self, size):
        self.size = size
        self.table = [None for _ in range(size)]

    def get_char(self, ch):
        if ch == 'A':
            return 1
        elif ch == 'C':
            return 2
        elif ch == 'G':
            return 3
        elif ch == 'T':
            return 4

    def get_key(self, string):
        sum = 0
        p = 1
        for s in string:
            sum += self.get_char(s) * p
            p *= 5
        return sum

    def hash1(self, key):
        return key % self.size

    def hash2(self, key):
        return 1 + key % (self.size - 1)

    def insert(self, string):
        key = self.get_key(string)
        i = 0
        while True:
            h = (self.hash1(key) + i * self.hash2(key)) % self.size
            if self.table[h] is None:
                self.table[h] = string
                return
            elif self.table[h] == string:
                return
            i += 1

    def find(self, string):
        key = self.get_key(string)
        i = 0
        while True:
            h = (self.hash1(key) + i * self.hash2(key)) % self.size
            if self.table[h] == string:
                return True
            elif self.table[h] is None:
                return False
            i += 1

h = HashTable(1046527)
n = int(input())
for _ in range(n):
    cmd = sys.stdin.readline().split()
    if cmd[0] == 'insert':
        h.insert(cmd[1])
    elif cmd[0] == 'find':
        if h.find(cmd[1]):
            print('yes')
        else:
            print('no')

Solution (Python):
import sys
from sys import stdin
input = stdin.readline
 
dic = {}
n = int(input())
for i in range(n):
    s = input()
    if s[0] == 'i': dic[s[7:]] = 1
    else: print("yes" if s[5:] in dic else "no")

Solution (Python):
from collections import deque
from enum import Enum
import sys
import math
 
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
 
DICTIONARY = {}
num_query = int(input())
 
for loop in range(num_query):
    input_str = input().split()
    if input_str[0] == 'insert':
        DICTIONARY[input_str[1]] = True
    else:
        if DICTIONARY.__contains__(input_str[1]):
            print("yes")
        else:
            print("no")

Solution (Python):
if __name__ == '__main__':
    res = set()
    n_order = int(input())
    for i in range(n_order):
        order = input().split()
        if 'insert' == order[0]: 
            res.add(order[1])
        elif 'find' == order[0]:
            if order[1] in res: print('yes')
            else : print('no')