pare=[-1]*(6*10**6+1) size=[1]*(6*10**6+1) count=[0]*(6*10**6+1) def root(x): while pare[x]!=-1: x=pare[x] return x def unite(u,v): rootu=root(u) rootv=root(v) if rootu!=rootv: if size[rootu]>=size[rootv]: pare[rootv]=rootu size[rootu]+=size[rootv] count[rootu]+=count[rootv] else: pare[rootu]=rootv size[rootv]+=size[rootu] count[rootv]+=count[rootu] def same(s,t): return root(s)==root(t) result=[1]*(3*10**6+1) used=[False]*(3*10**6+1) for x in range(2,3*10**6+1): if used[x]==True: continue z=1 for y in range(2,3*10**6): if x*y>3*10**6: break result[x*y]+=z if used[x*y]==False: used[x*y]=True z+=1 Q=int(input()) for _ in range(Q): N=int(input()) if result[N]%2==1: print('P') else: print('K')