lib C fun strtoll(s : UInt8*, p : UInt8**, b : Int32) : Int64 end class String def to_i64 C.strtoll(self, nil, 10) end end vowel, cons = "iaaeuu", "nbmgr" size = vowel.size + cons.size n = read_line.to_i s = (1..n).map { read_line }.to_set puts (0...6).flat_map { |vowel_pos| f = [0, 1] * 5 f.insert({0, vowel_pos * 2 - 1}.max, 1) Array.product(vowel.chars.permutations, cons.chars.permutations).map { |(v, c)| (0...11).map { |i| (f[i] == 0 ? c : v).shift(1)[0] }.join } }.find { |str| !s.includes?(str) } || "NO"