#include <stdio.h>
#include <string.h>
#include<functional>
#include <queue>
#include <algorithm>
using namespace std;
const int maxn = 100050;
const int inf = 1<<30;
int n,m;
int main()
{
#ifndef ONLINE_JUDGE
//freopen("data.txt","r",stdin);
#endif
int cas;
scanf("%d",&cas);
while( cas -- ){
scanf("%d%d",&n,&m);
printf("%s\n",n%(m+1)?"first":"second");
}
return 0;
}