#include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) {     while (b) {       a %= b;       swap(a, b);     }     return a;   }   int main() {     int t;     cin >> t;     while (t--) {       long long x, y;       cin >> x >> y;       if (gcd(x, y) == 1) {         cout <<  FINITE  << endl;       } else {         cout <<  INFINITE  << endl;       }     }   }   