include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
for(int i=1;i<=t;i++)
{
int a,b;
cin>>a>>b;
if((100-(100a/100))>(200-(200b/100)))
cout<<“SECOND\n”;
else if((100-(100a/100))<(200-(200b/100)))
cout<<“FRIST\n”;
else
cout<<“BOTH\n”;
}
}