n=gets.to_i s=gets.chomp c=s.count 'Q' if s.include?('H')||c<1 p -1;exit end a=s.chars.each_slice(n/c).to_a if a.any?{|e|e!=a[0]} p -1;exit end puts s