# 중도포기

T = int(input())

while T > 0:
    PS = input()
    VPS_list = []
    def VPS(x):
        p = str(())
        if x = p:
            return 1
        elif x = p + p:
            return 1
        elif x =
            return 1
    if VPS(PS) = 1:
        VPS_list.append(PS)

    if PS in VPS_list:
        print("YES")
    else:
        print("NO")
    T = T - 1
