Consider the set of all nonnegative integers: ${0, 1, 2, \dots}$. Given two integers $a$ and $b$ ($1 \le a, b \le 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 \ge a$ and $i - a$ is colored white, $i$ is also colored white;   if $i \ge 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 \le t \le 100$) — the number of test cases in the input. Then $t$ lines follow, each line contains two space-separated integers $a$ and $b$ ($1 \le a, b \le 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

Difficulty: interview

Starter code:

Solutions:
from math import gcd

n = int(input())
for i in range(n):
    a, b = list(map(int, input().split()))
    g = gcd(a, b)
    if g == 1:
        print("Finite")
    else:
        print("Infinite")

from math import gcd
for TT in range(1, int(input()) + 1):
    a, b = map(int, input().split())
    print(['Infinite', 'Finite'][gcd(a, b) == 1])

from math import  gcd

t=int(input())
for i in range(t):
    a, b=map(int, input().split())
    if gcd(a, b) == 1:
        print('Finite')
    else:
        print('Infinite')

# import sys
# input = sys.stdin.readline
n = int(input())

def gcd(x,y):
    while x != 0 and y != 0:
        x,y = max(x,y),min(x,y)
        x %= y
    return y
for i in range(n):
    a, b = map(int,input().split())
    if gcd(a,b) == 1:
        print("Finite")
    else:
        print("Infinite")

def gcd(a, b):
    return a if b == 0 else gcd(b, a % b)

for _ in range(int(input())):
    a, b = list(map(int, input().split()))
    if gcd(a, b) == 1:
        print("Finite")
    else:
        print("Infinite")


from math import gcd

t = int(input())
for i in range(t):
    a, b = map(int, input().split())
    if gcd(a, b) > 1:
        print('Infinite')
    else:
        print('Finite')

from math import gcd

t = int(input())

for _ in range(t):
	a, b = list(map(int,input().split()))
	if gcd(a, b)==1:
		print("Finite")
	else:
		print("Infinite")


def gcd(a,b):
	if a == 0:
		return b
	return gcd(b%a, a)
n = int(input())
for eq in range(n):
	a, b = map(int,input().split())
	if gcd(a,b) == 1:
		print("Finite")
	else:
		print("Infinite")

from math import *

q = int(input())

for i in range(q):
    a, b = map(int, input().split())
    
    if gcd(a, b) == 1:
        print("Finite")
    else:
        print("Infinite")

from math import gcd


t = int(input())
for i in range(t):
    a, b = map(int, input().split())
    if gcd(a, b) == 1:
        print("Finite")
    else:
        print("Infinite")

from math import *
from collections import *
def gcd(a,b):  
    if (b == 0): 
         return a 
    return gcd(b, a%b) 

t = int(input())
for y in range(t):
    a,b = list(map(int,input().split()))
    if(gcd(a,b) == 1): print("Finite")
    else: print("Infinite")


import math

n, = list(map(int, input().split()))
for _ in range(n):
    a, b = list(map(int, input().split()))
    if math.gcd(a, b) == 1:
        print("Finite")
    else:
        print("Infinite")


import math
for _ in range(int(input())):
    a,b=map(int,input().split())
    if math.gcd(a,b)==1:
        print("Finite")
    else:
        print("Infinite")

from math import *
t = int(input())
for i in range(t):
    a, b = map(int, input().split())
    if gcd(a, b) > 1:
        print('Infinite')
    else:
        print('Finite')

from math import *
for _ in range(int(input())):
    a,b=map(int,input().split())
    x=gcd(a,b)
    if(x!=1 and a%x==0 and b%x==0):
        print("Infinite")
    else:
        print('Finite')

from math import gcd

for _ in range(int(input())):
    a, b = map(int, input().split())
    print(['Infinite', 'Finite'][gcd(a, b) == 1])

import sys
input = sys.stdin.readline

import math

t=int(input())

for test in range(t):
    a,b=list(map(int,input().split()))
    k=math.gcd(a,b)

    if k!=1:
        print("Infinite")
    else:
        print("Finite")
    


from math import gcd
for i in range(int(input())):
    a,b=map(int,input().split())
    if gcd(a,b)==1:
        print("Finite")
    else:
        print("Infinite")

def gcd(a, b):
    while b != 0:
        a,b = b, a%b
    return a
n = int(input())
for i in range(n):
    a,b = list(map(int,input().split()))
    if gcd(a, b) == 1:
        print("Finite")
    else:
        print("Infinite")


def gcd(a,b):
    if b==0:
        return a 
    return gcd(b,a%b)
for _ in range(int(input())):
    a,b=map(int,input().split())
    print("Finite" if gcd(a,b)==1 else 'Infinite')

from math import gcd

for __ in range(int(input())):
    a, b = list(map(int, input().split()))
    if gcd(a, b) == 1:
        print('Finite')
    else:
        print('Infinite')

t=int(input())
def yin(a,b):
	if a%b==0:
		return b
	return yin(b,a%b)
for i in range(0,t):
	a,b=map(int,input().split())
	j=yin(max(a,b),min(a,b))
	if j==1:
		print('Finite')
	else:
		print('Infinite')

import math

t = int(input())
for test in range(t):
    a,b = map(int, input().split(" "))
    if math.gcd(a,b) == 1:
        print("Finite")
    else:
        print("Infinite")

from math import*
q=int(input())
for t in range(q):
    a,b=map(int,input().split())
    c=gcd(a,b)
    if c==1:
        print("Finite")
    else:
        print("Infinite")