MOD = 9999999999999937u64 MUL = 31 MULS = [1u64] 1000000.times do MULS << MULS[-1] * MUL % MOD end n = read_line.to_i hs = Array.new(1000001) { Set(UInt64).new } n.times do s = read_line.chars h = 0u64 s.size.times do |i| h += MULS[i] * s[i].ord h %= MOD end puts hs[s.size].includes?(h) ? "Yes" : "No" hs[s.size] << h (s.size - 1).times do |i| next if s[i] == s[i + 1] h2 = h + MULS[i + 1] * s[i].ord + MULS[i] * s[i + 1].ord h2 += MOD - MULS[i] * s[i].ord % MOD h2 += MOD - MULS[i + 1] * s[i + 1].ord % MOD hs[s.size] << h2 % MOD end end