require 'strscan' N = gets.to_i S = gets.chomp scanner = StringScanner.new(S) until scanner.eos? next if scanner.skip(/w[ao?]|n|\?[ao]|\?/) puts "No" exit end puts "Yes"