#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pint pair<ll,ll>
#define mk(x,y) make_pair(x,y)
#define fir first
#define sec second
#define Rep(x,y,z) for(ll x=y;x<=z;x)
#define Red(x,y,z) for(ll x=y;x>=z;--x)
using namespace std;
char buf[1<<12],*p1=buf,*p2=buf,nc;ll ny;
//inline char gc() {return p1p2&&(p2=(p1=buf)+fread(buf,1,1<<12,stdin),p1p2)?EOF:*p1;}
inline char gc(){return getchar();}
inline ll read(){
ll x=0;ny=1;while(nc=gc(),(nc<48||nc>57)&&nc!=EOF)if(nc==45)ny=-1;if(nc<0)return nc;
x=nc-48;while(nc=gc(),47<nc&&nc<58&&nc!=EOF)x=(x<<3)+(x<<1)+(nc^48);return x*ny;
}struct BigInteger {
typedef unsigned long long LL;
};
ostream& operator << (ostream& out, const BigInteger& x) {
out << x.s.back();
for (int i = x.s.size()-2; i >= 0; i--) {
char buf[20];
sprintf(buf, "%08d", x.s[i]);
for (int j = 0; j < strlen(buf); j++) out << buf[j];
}
return out;
}
istream& operator >> (istream& in, BigInteger& x) {
string s;
if (!(in >> s)) return in;
x = s;
return in;
}
ll A2[70],A10[25],vis[1050],A30[60];
inline void pre(){
ll t=0;
Rep(i,1,1024){
vis[i]=(vis[i>>1]^(i&1));
if(vis[i])A2[t]=i;
}Rep(i,0,10)A10[i]=1<<i;Rep(i,12,16)A10[i]=1<<i-1;Rep(i,18,19)A10[i]=1<<i-2;
A10[11]=(1<<11)-1,A10[17]=(1<<16)-(1<<11)+(1<<6)-1;
Red(i,20,1)A10[i]=A10[i-1];A10[0]=0;
Rep(i,0,30)A30[i]=1<<i;Rep(i,32,46)A30[i]=1ll<<i-1;Rep(i,48,54)A30[i]=1ll<<i-2;
A30[31]=(1ll<<31)-1,A30[47]=(1ll<<46)-(1ll<<31)+(1<<16)-1;
Red(i,55,1)A30[i]=A30[i-1];A30[0]=0;
}ll n,k;
inline ll Get(){
ll x=read();
for(ll cnt=1;x;x/=k+1,cnt)if(x%(k+1)k)return cnt;
return 0;
}inline ll GetB(){
BigInteger x;cin>>x;
for(ll cnt=1;x!=0;x/=k+1,cnt++)if(x%(k+1)k)return cnt;
return 0;
}
inline void Solve1(){
ll tot=0;
Rep(i,1,n)tot^=read();
if(tot)puts("Preempt.");else puts("Leapfrog.");
}inline void Solve2(){
ll tot=0;
Rep(i,1,n)tot^=A2[Get()];
if(tot)puts("Preempt.");else puts("Leapfrog.");
}inline void Solve10(){
ll tot=0;
Rep(i,1,n)tot^=A10[Get()];
if(tot)puts("Preempt.");else puts("Leapfrog.");
}inline void Solve30(){
ll tot=0;
Rep(i,1,n)tot^=A30[GetB()];
if(tot)puts("Preempt.");else puts("Leapfrog.");
}
int main(){
pre();
for(ll t=read();t--;){
n=read(),k=read();
if(k1)Solve1();
else if(k2)Solve2();
else if(k10)Solve10();
else if(k30)Solve30();
}
return 0;
}