#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<set>
using namespace std;
#define ll long long
int main()
{
int t,n,m;
cin>>t;
while (t--)
{
cin>>n>>m;
int mod=n%(m+1);
if(mod>=1)
cout<<"first"<<endl;
else
cout<<"second"<<endl;
}
return 0;
}