import random base = random.randint(30,1000) mod = random.randint(10**7,10**15) mod2 = random.randint(10**7,10**15) M = 10**6+2 pows = [1]*M for i in range(1,M-1): pows[i] = pows[i-1]*base%mod hash = [set() for i in range(M)] hash2 = [set() for i in range(M)] n = int(input()) for _ in range(n): s = list(input()) ls = len(s) find = 0 num = 0 num2 = 0 for i,j in enumerate(s): k = ord(j)-ord("a") num += pows[i]*k num %= mod num2 += pows[i]*k num2 %= mod2 if (num,num2) in hash[ls]: find = 1 for i in range(ls-1): x = ord(s[i])-ord("a") y = ord(s[i+1])-ord("a") temp = num + (y-x)*pows[i]+ (x-y)*pows[i+1] temp %= mod temp2 = num2 + (y-x)*pows[i]+ (x-y)*pows[i+1] temp2 %= mod2 if (temp,temp2) in hash[ls]: find = 1 print("Yes" if find else "No") hash[ls].add((num,num2))