import sys input = sys.stdin.readline N=int(input()) S=[list(input().strip()) for i in range(N)] # Rolling Hash LEN=len(S) p=26 # 文字の種類 mod=618970019642690137449562111 MAX=0 for s in S: MAX=max(MAX,len(s)) CHECKLEN=[set() for i in range(MAX+1)] POWP=[1] for i in range(10**6+1): POWP.append(POWP[-1]*p%mod) for s in S: LEN=len(s) score=0 for i in range(LEN): score=(score+(ord(s[i])-97)*POWP[i])%mod if score in CHECKLEN[LEN]: print("Yes") else: print("No") CHECKLEN[LEN].add(score) for i in range(LEN-1): score2=score-(ord(s[i])-97)*POWP[i]-(ord(s[i+1])-97)*POWP[i+1]+(ord(s[i+1])-97)*POWP[i]+(ord(s[i])-97)*POWP[i+1] CHECKLEN[LEN].add(score2)