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