N = int(input()) S = input() if S == "Q": print("Q") else: print(-1)