from collections import defaultdict, deque, Counter from functools import cache # import copy from itertools import combinations, permutations, product, accumulate, groupby, chain from heapq import heapify, heappop, heappush import math import bisect from pprint import pprint from random import randint, shuffle import sys # sys.setrecursionlimit(200000) input = lambda: sys.stdin.readline().rstrip('\n') inf = float('inf') mod1 = 10**9+7 mod2 = 998244353 def ceil_div(x, y): return -(-x//y) ################################################# T = int(input()) for _ in range(T): N = int(input()) S = list(input().split("-")) x = 0 for s in S: if s == "" or s[0] != s[-1]: continue x += 1 if s[0] == "K" else -1 print("K" if x >= 0 else "P")