n = input() s = input() if s.count('Q') == 1 and 'H' not in s: print(s) else: print(-1)