You are given two positive integers $a$ and $b$.

In one move, you can change $a$ in the following way:

  Choose any positive odd integer $x$ ($x > 0$) and replace $a$ with $a+x$;  choose any positive even integer $y$ ($y > 0$) and replace $a$ with $a-y$. 

You can perform as many such operations as you want. You can choose the same numbers $x$ and $y$ in different moves.

Your task is to find the minimum number of moves required to obtain $b$ from $a$. It is guaranteed that you can always obtain $b$ from $a$.

You have to answer $t$ independent test cases.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

Then $t$ test cases follow. Each test case is given as two space-separated integers $a$ and $b$ ($1 \le a, b \le 10^9$).


-----Output-----

For each test case, print the answer — the minimum number of moves required to obtain $b$ from $a$ if you can perform any number of moves described in the problem statement. It is guaranteed that you can always obtain $b$ from $a$.


-----Example-----
Input
5
2 3
10 10
2 4
7 4
9 3

Output
1
0
2
2
1



-----Note-----

In the first test case, you can just add $1$.

In the second test case, you don't need to do anything.

In the third test case, you can add $1$ two times.

In the fourth test case, you can subtract $4$ and add $1$.

In the fifth test case, you can just subtract $6$.

Difficulty: introductory

Starter code:

Solutions:
for _ in range(int(input())):
    a, b = list(map(int, input().split()))
    if a == b:
        print(0)
    else:
        if a < b:
            if (b - a) % 2:
                print(1)
            else:
                print(2)
        else:
            if (b - a) % 2 == 0:
                print(1)
            else:
                print(2)


import sys

def fast_input():
    return sys.stdin.readline().strip()

def data_input():
    return [int(x) for x in fast_input().split()]

def binary_search(array, x):
    left, right = -1, len(array)
    while left + 1 != right:
        middle = (left + right) // 2
        if array[middle] >= x:
            right = middle
        elif array[middle] < x:
            left = middle
    return right

def solve_of_problem():
    a, b = data_input()
    if (b - a) % 2 == 1 and a < b:
        print(1)
    elif (b - a) % 2 == 0 and b < a:
        print(1)
    elif a == b:
        print(0)
    else:
        print(2)
    return

for ______ in range(int(fast_input())):
    solve_of_problem()

q = int(input())
for wrere in range(q):
	a,b = map(int,input().split())
	if a<b:
		if (a-b)%2 == 1:
			print(1)
		else:
			print(2)
	else:
		if a == b:
			print(0)
		else:
			if (a-b)%2 == 0:
				print(1)
			else:
				print(2)

for nt in range(int(input())):
	a,b=map(int,input().split())
	if b==a:
		print (0)
		continue
	if b>a:
		if (b-a)%2==1:
			print (1)
			continue
		else:
			print (2)
			continue
	else:
		if (a-b)%2==0:
			print (1)
			continue
		else:
			print (2)

t = int(input())
for z in range(t):
	a,b = list(map(int,input().split()))
	ans = 0
	if a>b:
		if (a-b)%2 == 0:
			ans = 1
		else:
			ans = 2
	elif a<b:
		if (b-a)%2 == 0:
			ans = 2
		else:
			ans = 1
	print(ans)


from sys import stdin


def solve():
    a, b = list(map(int, input().split()))
    if a == b:
        print(0)
    elif (b - a) % 2 and a < b:
        print(1)
    elif (a - b) % 2 == 0 and a > b:
        print(1)
    else:
        print(2)


for i in range(int(input())):
    solve()


def main():
    a, b = list(map(int, input().split()))
    if a == b:
        print(0)
    elif a > b:
        if (b - a) % 2 == 0:
            print(1)
        else:
            print(2)
    else:
        if (b - a) % 2 == 0:
            print(2)
        else:
            print(1)


def __starting_point():
    t = int(input())
    for i in range(t):
        main()

__starting_point()

import math


class Read:
    @staticmethod
    def string():
        return input()

    @staticmethod
    def int():
        return int(input())

    @staticmethod
    def list(sep=' '):
        return input().split(sep)

    @staticmethod
    def list_int(sep=' '):
        return list(map(int, input().split(sep)))


def solve():
    a, b = Read.list_int()
    if a == b:
        print(0)
    elif a > b:
        if (a - b) % 2 == 0:
            print(1)
        else:
            print(2)
    else:
        if (b - a) % 2 == 1:
            print(1)
        else:
            print(2)


# query_count = 1
query_count = Read.int()
while query_count:
    query_count -= 1
    solve()


t = int(input())
while t:
    t += -1
    a, b = map(int, input().split())
    if b == a: print(0)
    elif b > a:
        if (b - a) % 2: print(1)
        else: print(2)
    else:
        if (a - b) % 2: print(2)
        else: print(1)

t = int(input())
for _ in range(t):
    a, b = list(map(int, input().split()))
    if a==b:
        print(0)
    elif a%2==b%2:
        if a>b:
            print(1)
        else:
            print(2)
    else:
        if a>b:
            print(2)
        else:
            print(1)


t = int(input())
for iii in range(t):
	a, b = list(map(int, input().split()))
	tmp = b - a
	if tmp == 0:
		print(0)
	elif (a < b and tmp % 2 == 1) or (a > b and tmp % 2 == 0):
		print(1)
	else:
		print(2)


T = int(input())

for t in range(T):
    a, b = list(map(int, input().split()))
    res = 0
    if b > a:
        if (b % 2) != (a % 2):
            res = 1
        else:
            res = 2
    elif b < a:
        if (b % 2) == (a % 2):
            res = 1
        else:
            res = 2
    print(res)


#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=int(input())
for tt in range(t):
    #n=int(input())
    a,b= map(int, sys.stdin.readline().split(' '))

    if(a==b):
        print(0)
    elif(a>b):
        if((a-b)%2==0):
            print(1)
        else:
            print(2)
    else:
        if((a-b)%2):
            print(1)
        else:
            print(2)
    #a=list(map(int,sys.stdin.readline().split(' ')))
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

t=int(input())
for _ in range(t):
    a,b=[int(x) for x in input().split()]
    if(a==b):
        print(0)
    elif(a>b):
        if((a-b)%2==0):
            print(1)
        else:
            print(2)
    else:
        if((b-a)%2==0):
            print(2)
        else:
            print(1)


t = int(input())
for i in range(t):
    a, b = map(int, input().split())
    if a == b:
        print(0)
    elif (a & 1) == (b & 1):
        if a < b:
            print(2)
        else:
            print(1)
    elif a < b:
        print(1)
    else:
        print(2)

for _ in range(int(input())):
    a,b = list(map(int,input().split()))
    if b==a:
        print(0)
    elif b>a:
        if (b-a)%2==0:
            print(2)
        else:
            print(1)
    else:
        if (a-b)%2==0:
            print(1)
        else:
            print(2)
        


t = int(input().strip())
for _ in range(t):
    a,b = list(map(int,input().strip().split()))
    #nums = [int(i) for i in input().strip().split()]
    if a == b:
        print(0)
    elif a > b:
        if (a - b)%2 == 0:
            print(1)
        else:
            print(2)
    else:
        if (b - a)%2 != 0:
            print(1)
        else:
            print(2)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput

def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(map(int, input().split()))
def lcm(a, b): return abs(a * b) // math.gcd(a, b)
def revn(n): return str(n)[::-1]
def dd(): return collections.defaultdict(int)
def ddl(): return collections.defaultdict(list)
def sieve(n):
    if n < 2: return list()
    prime = [True for _ in range(n + 1)]
    p = 3
    while p * p <= n:
        if prime[p]:
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 2
    r = [2]
    for p in range(3, n + 1, 2):
        if prime[p]:
            r.append(p)
    return r
def divs(n, start=2):
    r = []
    for i in range(start, int(math.sqrt(n) + 1)):
        if (n % i == 0):
            if (n / i == i):
                r.append(i)
            else:
                r.extend([i, n // i])
    return r
def divn(n, primes):
    divs_number = 1
    for i in primes:
        if n == 1:
            return divs_number
        t = 1
        while n % i == 0:
            t += 1
            n //= i
        divs_number *= t
def prime(n):
    if n == 2: return True
    if n % 2 == 0 or n <= 1: return False
    sqr = int(math.sqrt(n)) + 1
    for d in range(3, sqr, 2):
        if n % d == 0: return False
    return True
def convn(number, base):
    newnumber = 0
    while number > 0:
        newnumber += number % base
        number //= base
    return newnumber
def cdiv(n, k): return n // k + (n % k != 0)


for _ in range(ii()):
    a, b = mi()
    if a == b:
        print(0)
    elif a < b and (b - a) % 2 == 0 or a > b and (a - b) % 2:
        print(2)
    else:
        print(1)

t = int(input())
for _ in range(t):
	a, b = map(int, input().split())
	if a == b:
		print(0)
	elif a < b and (b-a)%2 == 1:
		print(1)
	elif a > b and (a-b)%2 == 0:
		print(1)
	else:
		print(2)

t = int(input())
for i in range(t):
    a, b = list(map(int, input().split()))
    if (a == b):
        print(0)
    elif (a % 2 == b % 2 and a > b):
        print(1)
    elif (a % 2 != b % 2 and b > a):
        print(1)
    else:
        print(2)


t = int(input())

for _ in range(t):
    a, b = map(int, input().split())
    if a == b:
        print("0")
    elif a > b:
        if (a - b) % 2:
            print(2)
        else:
            print(1)
    else:
        if (b - a) % 2:
            print(1)
        else:
            print(2)

import sys
input = sys.stdin.readline

def main():
    for _ in range(int(input())):
        a, b = map(int,input().split()) 
        if a == b:
            print(0)
            continue
        if a < b:
            if a % 2 == b % 2:
                print(2)
            else:
                print(1)
            
        else:
            if a % 2 == b % 2:
                print(1)
            else:
                print(2)


main()

for _ in range(int(input())):
    
    a,b = map(int,input().split())
    
    if(a==b):
        print(0)
    elif(a>b):
        h = a-b
        if(h%2 == 0):
            print(1)
        else:
            print(2)
    else:
        h = b-a
        if(h%2 == 1):
            print(1)
        else:
            print(2)

t = int(input())

for _ in range(t):
    a, b = map(int, input().split(' '))

    if a == b:
        print(0); continue
    
    if b > a:
        if a & 1 == b & 1:
            print(2); continue
        else:
            print(1); continue
    else:
        if a & 1 == b & 1:
            print(1); continue
        else:
            print(2); continue

# -*- coding: utf-8 -*-

import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return list(map(int, input().split()))
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
# sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

for _ in range(INT()):
    a, b = MAP()

    if a == b:
        print(0)
    elif a < b:
        if abs(a - b) % 2 == 0:
            print(2)
        else:
            print(1)
    else:
        if abs(a - b) % 2 == 0:
            print(1)
        else:
            print(2)


def getarr(): return(list(map(int, input().split())))

def solve():
	a, b = getarr()
	if (a==b):
		print(0)
	if (a < b):
		diff = abs(a - b)
		if (diff % 2 == 1): print(1)
		else: print(2)

	if (a > b):
		diff = abs(a - b)
		if (diff % 2 == 0): print(1)
		else: print(2)

for t in range(int(input())): solve()

t=int(input())
for _ in range(t):
    a,b=list(map(int,input().split()))
    if a==b:
        print(0)
    elif b-a>0 and (b-a)%2!=0:
        print(1)
    elif b-a>0 and (b-a)%2==0:
        print(2)
    elif a-b>0 and (b-a)%2==0:
        print(1)
    elif a-b>0 and (b-a)%2!=0:
        print(2)

import sys
input = sys.stdin.readline
def getInt(): return int(input())
def getVars(): return list(map(int, input().split()))
def getList(): return list(map(int, input().split()))
def getStr(): return input().strip()
## -------------------------------

t = getInt()
for i in range(t):
    a, b = getVars()
    if a == b:
        print(0)
    elif a > b:
        if a%2 == b%2:print(1)
        else: print(2)
    else:
        if a%2 == b%2:print(2)
        else:print(1)


t = int(input())

for i in range(t):
    line = input()
    [a, b] = [int(x) for x in line.split(' ')]
    
    if a == b:
        print(0)
    
    if a > b:
        if a % 2 == b % 2:
            print(1)
        else:
            print(2)
    
    elif a < b:
        if a % 2 == b % 2:
            print(2)
        else:
            print(1)


from math import ceil as cc
def mi():
    return map(int, input().split())
'''
5
2 3
10 10
2 4
7 4
9 3
'''
n = int(input())
for i in range(n):
    a,b = mi()
    if a==b:
        print(0)
    elif (b-a)%2==0 and b>a:
        print(2)
    elif (b-a)%2 and b>a:
        print(1)
    elif (b-a)%2==0 and b<a:
        print(1)
    else:
        print(2)