Consider the set of all nonnegative integers: {0, 1, 2, ...}. Given two integers a and b (1 ≤ a, b ≤ 10^4). We paint all the numbers in increasing number first we paint 0, then we paint 1, then 2 and so on.

Each number is painted white or black. We paint a number i according to the following rules: 

  * if i = 0, it is colored white; 
  * if i ≥ a and i - a is colored white, i is also colored white; 
  * if i ≥ b and i - b is colored white, i is also colored white; 
  * if i is still not colored white, it is colored black. 



In this way, each nonnegative integer gets one of two colors.

For example, if a=3, b=5, then the colors of the numbers (in the order from 0) are: white (0), black (1), black (2), white (3), black (4), white (5), white (6), black (7), white (8), white (9), ...

Note that: 

  * It is possible that there are infinitely many nonnegative integers colored black. For example, if a = 10 and b = 10, then only 0, 10, 20, 30 and any other nonnegative integers that end in 0 when written in base 10 are white. The other integers are colored black. 
  * It is also possible that there are only finitely many nonnegative integers colored black. For example, when a = 1 and b = 10, then there is no nonnegative integer colored black at all. 



Your task is to determine whether or not the number of nonnegative integers colored black is infinite.

If there are infinitely many nonnegative integers colored black, simply print a line containing "Infinite" (without the quotes). Otherwise, print "Finite" (without the quotes).

Input

The first line of input contains a single integer t (1 ≤ t ≤ 100) — the number of test cases in the input. Then t lines follow, each line contains two space-separated integers a and b (1 ≤ a, b ≤ 10^4).

Output

For each test case, print one line containing either "Infinite" or "Finite" (without the quotes). Output is case-insensitive (i.e. "infinite", "inFiNite" or "finiTE" are all valid answers).

Example

Input


4
10 10
1 10
6 9
7 3


Output


Infinite
Finite
Infinite
Finite

import javax.print.DocFlavor;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.IllegalCharsetNameException;
import java.sql.SQLOutput;
import java.util.*;



public class Main {
    static int[][] R;
    static int[] parent; /// DSU



    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        int q = Reader.nextInt();
        while (q-->0){
            solve(0);
        }

    }

    static long get(long[] a , long[] b){
        long sum = 0;
        for (int i = 0 ; i < 3 ; i++){
            sum+=(a[i]-b[i])*(a[i]-b[i]);
        }
        return sum;
    }

    static void solve(int k) throws IOException{
        int a = Reader.nextInt();
        int b = Reader.nextInt();
        if (gcd(a,b)==1){
            System.out.println("Finite");
        }
        else{
            System.out.println("Infinite");
        }



    }
    public static long asBase3(int num) {
        long ret = 0, factor = 1;
        while (num > 0) {
            ret += num % 3 * factor;
            num /= 3;
            factor *= 10;
        }
        return ret;
    }

    public static boolean FindAllElements(int n, int k)
    {
        //System.out.println(n);
        // Initialising the sum with k
        int sum = k;

        // Initialising an array A with k elements
        // and filling all elements with 1
        int[] A = new int[k];
        Arrays.fill(A, 0, k, 1);

        for (int i = k - 1; i >= 0; --i) {

            // Iterating A[] from k-1 to 0
            while (sum + A[i] <= n) {

                // Update sum and A[i]
                // till sum + A[i] is less than equal to n
                sum += A[i];
                A[i] *= 2;
            }
        }

        // Impossible to find the combination
        if (sum != n) {
            return false;
        }

        // Possible solution is stored in A[]
        return true;
    }



    static long gcd(long a, long b)
    {
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }

    // method to return LCM of two numbers
    static long lcm(long a, long b)
    {
        return (a*b)/gcd(a, b);
    }

    public static void sortbyColumn(int arr[][], int col)
    {
        // Using built-in sort function Arrays.sort
        Arrays.sort(arr, new Comparator<int[]>() {

            @Override
            // Compare values according to columns
            public int compare(final int[] entry1,
                               final int[] entry2) {

                // To sort in descending order revert
                // the '>' Operator
                return entry1[col] - entry2[col];
            }
        });  // End of function call sort().
    }
    static int find(int a){
        if (parent[a]!=a){
            parent[a] = find((int)parent[a]);
        }
        return parent[a];
    }

















}

class TrieNode{

    static int size;
    static TrieNode root = new TrieNode();
    int isEnd;
    int leafs;

    int value;
    TrieNode[] arr = new TrieNode[2];
    public TrieNode(){
        value = 0;
        arr[0] = null;
        arr[1] = null;
    }

    static void insert(int n){
        TrieNode node = root;
        root.leafs++;
        for (int i = size -1;  i>=0 ; i--){
            int val = (n&(1<<i)) >= 1? 1:0;
            if(node.arr[val]==null){
                node.arr[val]=new TrieNode();
            }
            node = node.arr[val];
            node.leafs++;
        }
        node.value = n;
        node.isEnd++;
    }

    static int query(int n , int k){
        TrieNode tmp = root;
        int ans = 0;
        long num = 0;
        for(int i = size-1 ; i>=0 ; i--){
            //System.out.println(i);
            int val = ((n>>i)&1);
            //System.out.println(n + " " +val + " " + num + " " + i);
            if (tmp==null){
                //System.out.println("BREAK");
                break;
            }
            //System.out.println((num | (1<< i)));
            if ((num | (1<< i))>=k){
                if (val==1){
                    if (tmp.arr[0]!=null){
                        ans+=tmp.arr[0].leafs;
                    }
                }
                else{
                    if (tmp.arr[1]!=null){
                        ans+=tmp.arr[1].leafs;
                    }
                }
                tmp = tmp.arr[val];
            }
            else {
                if (val==1){
                    tmp = tmp.arr[0];
                }
                else{
                    tmp = tmp.arr[1];
                }
                num |=(1<<i);
            }
        }
        //System.out.println(num);
        if (num>=k){
            ans+=tmp.leafs;
        }
        //System.out.println();

        return ans;
    }

}

class Edge implements Comparable<Edge>{
    int x , y , w;

    public Edge(int x, int y, int w) {
        this.x = x;
        this.y = y;
        this.w = w;
    }

    @Override
    public int compareTo(Edge o) {
        return this.w - o.w;
    }
}
class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }
    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
}
class MergeSort
{
    // Merges two subarrays of arr[].
    // First subarray is arr[l..m]
    // Second subarray is arr[m+1..r]
    void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int [n1];
        int R[] = new int [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];


        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

    /* A utility function to print array of size n */
    static void printArray(int arr[])
    {
        int n = arr.length;
        for (int i=0; i<n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }

    // Driver method

}

class Node implements Comparable<Node>{
    int a;
    int b;
    Node (int a , int b){
        this.a = a;
        this.b = b;
    }



    public int compareTo(Node o) {
        if ((this.a%2) == (o.a%2)){
            return (this.b - o.b);
        }
        else{
            return this.a - o.a;
        }
    }
}