前面的wrong answer 了
//#include <iostream>
//#include<stdio.h>//using namespace std;
//
//int main()
//{
// int t,n,m;
// scanf("%d",&t);
// while(t--)
// {
// scanf("%d %d",&n,&m);
// int flag=0;
// for(int i=0; i<=m; i++)
// {
// if(n-i>=m+1&&(n-i)%(m+1)==0)
// {
// flag=1;
// printf("first\n");
// break;
// }
// }
// if(flag==0)
// printf("second\n");
// }
//
// return 0;
//}
#include <iostream>
#include<stdio.h>
using namespace std;
int main()
{
int t,n,m;
scanf("%d",&t);
while(t--)
{
scanf("%d %d",&n,&m);
if(n%(m+1)==0)
printf("second\n");
else
printf("first\n");
}
return 0;
}