n = int(input()) s = input() if s == "Q" * n: print(s) else: print(-1)