gets.to_i.times do n,s = gets.chomp.split s = s[0...n.to_i] puts s =~ /ooo|-oo|oo-|o-o|--o-|-o--/ ? 'O' : 'X' end