#include<bits/stdc++.h>
using namespace std;
int main (){
int t;
cin>>t;
while(t--){
string a,b;
cin>>a>>b;
if(a==b)puts("Tie");
else if(a=="Hunter"&&b=="Gun"||a=="Bear"&&b=="Hunter"||a=="Gun"&&b=="Bear")
puts("Player1");
else puts("Player2");
}
return 0;
}