#include using namespace std; typedef long long ll; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b1) continue; if(!solve(Y,N)) return dp[X][N]=1; } //cout< prime;//i番目の素数 int is_prime[MAX+1]; void sieve(int n){ for(int i=0;i<=n;i++){ is_prime[i]=true; } is_prime[0]=is_prime[1]=false; for(int i=2;i<=n;i++){ if(is_prime[i]){ prime.push_back(i); for(int j=2*i;j<=n;j+=i){ is_prime[j] = false; } } } for(int i=1;i<=n;i++) is_prime[i]+=is_prime[i-1]; } int main(){ std::ifstream in("text.txt"); std::cin.rdbuf(in.rdbuf()); cin.tie(0); ios::sync_with_stdio(false); memset(dp,-1,sizeof(dp)); int Q;cin>>Q; while(Q--){ ll N;cin>>N; if(N<=100){ if(!solve(N,N)) cout<<"P\n"; else cout<<"K\n"; }else{ ll Z=-1; for(ll i=2;i<=N;i++){ if(N%i){ Z=i; break; } } if(gcd(N,Z)>1) cout<<"P\n"; else cout<<"K\n"; } continue; if(N==2||N%12==6||N%420==0) cout<<"P\n"; else cout<<"K\n"; } return 0; memset(dp,-1,sizeof(dp)); for(int N=2;N<=2000;N++){ int Z=-1; for(int i=2;i<=N;i++){ if(N%i){ Z=i; break; } } cout<1)<>Q; while(Q--){ int N;cin>>N; if(is_prime[N]-is_prime[N-1]){ cout<<"P\n"; continue; } int sum=N-2; sum-=(is_prime[N-1]-is_prime[N/2]); if(sum%2==0) cout<<"P\n"; else cout<<"K\n"; } }