N = gets.to_i memo = {} chars = [*?a..?z] last_chars = [*?a..?z]-[?n] first_char = chars.sample (N-1).times{ last_char = last_chars.sample s = first_char + rand(0..18).times.map{chars.sample}*"" + last_char redo if memo[s] memo[s] = true puts s first_char = last_char } puts first_char + ?n