#include using namespace std; int main() { int T; scanf("%d", &T); while (T--) { int n, m; scanf("%d %d", &n, &m); if (n % (m + 1) == 0) cout << "second" << endl; else cout << "first" << endl; } return 0; }