N = int(input()) S = input() if len(set(S)) == 1 and S[0] == "Q": print(S) else: print(-1)