T = int(input()) for _ in range(T): N = int(input()) S = input() k, p = 0, 0 left = "" right = "" for i in range(N): if S[i] == "-": if i >= 1 and S[i-1] != "-": if left == "K" and right == "K": k += 1 elif left == "P" and right == "P": p += 1 else: right = S[i] if i == 0 or S[i-1] == "-": left = S[i] if S[-1] != "-": if left == "K" and right == "K": k += 1 elif left == "P" and right == "P": p += 1 if k >= p: print("K") else: print("P")