You are given two integers a and b.

In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k in different moves.

Your task is to find the minimum number of moves required to obtain b from a.

You have to answer t independent test cases.

Input

The first line of the input contains one integer t (1 ≤ t ≤ 2 ⋅ 10^4) — the number of test cases. Then t test cases follow.

The only line of the test case contains two integers a and b (1 ≤ a, b ≤ 10^9).

Output

For each test case, print the answer: the minimum number of moves required to obtain b from a.

Example

Input


6
5 5
13 42
18 4
1337 420
123456789 1000000000
100500 9000


Output


0
3
2
92
87654322
9150

Note

In the first test case of the example, you don't need to do anything.

In the second test case of the example, the following sequence of moves can be applied: 13 → 23 → 32 → 42 (add 10, add 9, add 10).

In the third test case of the example, the following sequence of moves can be applied: 18 → 10 → 4 (subtract 8, subtract 6).
#!/usr/bin/python3

"""
// math.hypot(x1-x2, y1-y2)
sqrt( (x1-x2)**2 + (y1-y2)**2 )

Fold All Levels ( ALT + 0 )
Unfold All Levels ( ALT + SHIFT + 0 )

list.index(element)

problème de la corde
def p():
    N = int(input())
    tab = map(int, list(input().split()))
    d = {i+1: val for i, val in enumerate(tab)}
    for i in range(2, N+1):
        for j in range(1, i):
            d[i] = max(d[i], d[j] + d[i-j])
    print(d[N])


#Complexity: O(max(log2(a), log2(b)))
def gcd(a,b):
	while b:
		a,b=b,a%b
	return a

#Complexity: O(max(log2(a), log2(b)))
def lcm(a,b):
	w=a//gcd(a,b)
	return w*b

"""


import sys
import math
import itertools
from sys import stdin, stdout
from functools import lru_cache

import statistics
import datetime
import collections


M_PI = 3.14159265358979323846


sys.setrecursionlimit(2000) # default: 1000

## ---------------------------------------------------------------------------


def problemA():
    t = intput()
    for i in range(t):
        a, b = intlist()
        c = abs(a-b)
        if a == b:
            print(0)
        elif a < b:
            if c%2==1:
                print(1)
            else:
                print(2)
        else:
            if c%2==1:
                print(2)
            else:
                print(1)






def main():
    problemA()


## ---------------------------------------------------------------------------

def intput():
    return int(stdin.readline())
def floatput():
    return float(stdin.readline())
def intlist():
    return list(map(int, stdin.readline().split()))
def floatlist():
    return list(map(float, stdin.readline().split()))

## ---------------------------------------------------------------------------
class Point:
    def __init__(self, x=0, y=0, z=0):
        self.x, self.y, self.z = x, y, z
    def distance(self, point):
        return math.sqrt((point.x-self.x)**2 + (point.y-self.y)**2 + (point.z-self.z)**2)
    def manhattan_distance(self, point):
        return abs(self.x-point.x) + abs(self.y-point.y) + abs(self.z-point.z)
    def __add__(self, point):
        return Point(self.x+point.x, self.y+point.y, self.z+point.z)
    def __sub__(self, point):
        return Point(self.x+point.x, self.y+point.y, self.z+point.z)
    def __mul__(self, alpha):
        return Point(self.x*alpha, self.y*alpha, self.z*alpha)
    def __truediv__(self, alpha):
        return Point(self.x/alpha, self.y/alpha, self.z/alpha)
    def __eq__(self, point):
        return self.x == point.x and self.y == point.y and self.z == point.z
    def __ne__(self, point):
        return not self.__eq__(point)


## ---------------------------------------------------------------------------
def isBissextile(year):
    return not(year%400) or ((year%100) and not(year%4))

def getCombinations(my_list):
    combinations = []
    for L in range(0, len(my_list)+1):
        for subset in itertools.combinations(my_list, L):
            combinations.append(subset)
    return combinations

def is_palindrome(value:str) -> bool:
    return str(value) == str(value)[::-1]

def factorial(n:int) -> int:
    f = 1
    for i in range(2, n+1):
        f *= i
    return f

def numberToBase(n, base) -> [int]:
    if n == 0:
        return [0]
    digits = []
    while n:
        digits.append(int(n % base))
        n //= base
    return digits[::-1]

def toRoman(nb:int) -> str:
    tab = ['I', 'V', 'X', 'L', 'C', 'D', 'M']
    power = 0
    answer = ""
    while nb!=0:
        num = nb%10
        nb//=10
        if   num==0: pass
        elif num==1: answer = tab[power] + answer
        elif num==2: answer = tab[power] + tab[power] + answer
        elif num==3: answer = tab[power] + tab[power] + tab[power] + answer
        elif num==4: answer = tab[power] + tab[power+1] + answer
        elif num==5: answer = tab[power+1] + answer
        elif num==6: answer = tab[power+1] + tab[power] + answer
        elif num==7: answer = tab[power+1] + tab[power] + tab[power] + answer
        elif num==8: answer = tab[power+1] + tab[power] + tab[power] + tab[power] + answer
        elif num==9: answer = tab[power] + tab[power+2] + answer
        power+=2
    return answer


## ---------------------------------------------------------------------------

def corde():
    N = int(input())
    tab = map(int, list(input().split()))
    d = {i+1: val for i, val in enumerate(tab)}
    for i in range(2, N+1):
        for j in range(1, i):
            d[i] = max(d[i], d[j] + d[i-j])
    print(d[N])


def LIS(X):
    M = [-1]*(len(X)+1) # M[j] contient l'index k du plus petit élément X[k] de la suite de taille j finissant par X[k] 
    P = [-1]*(len(X))   # P[k] contient le prédécesseur de X[k]
    L=0
    for i in range(len(X)): # Binary search for largest positive j<=L # X[M[j]] < X[i]
        deb=1
        fin=L
        while deb <= fin:
            mid = math.ceil((1.0*deb+fin)/2)
            if X[M[mid]] < X[i]:
                deb = mid+1
            else:
                fin = mid-1
        newL = deb        
        P[i] = M[newL-1]
        M[newL] = i
        if newL > L:
            L = newL
    S = [-1]*L
    index = M[L]
    for i in reversed(range(0, L)):
        S[i]  = X[index]
        index = P[index]
    #print(S)
    return L

def knapsack0(capacity, items):
    """Multiple occurences for each item."""
    dp = [False]*(capacity+1)
    dp[0] = True
    for i in range(1,capacity+1):
        j=0
        while j<len(items) and not(dp[i]):
            if i-items[j]>=0 and dp[i-items[j]]:
                dp[i]=True
            j+=1
    answer = capacity
    while not(dp[answer]):
        answer -= 1
    return answer


def knapsack3(W , wt , val , n=-1, init=True):
    """2D knapsack with values."""
    if init: # init the memoization
        maxValue = 10000
        maxPieces = len(wt)+1
        knapsack3.dp = [ [-1 for _i in range(maxPieces)] for _j in range(maxValue) ]
    if n==-1: # init the number of pieces
        n=len(wt)
    if knapsack3.dp[W][n] != -1: # if set of params already computed
        return knapsack3.dp[W][n]
    
    if n == 0 or W == 0: # Base Case : no capacity OR no item
        return 0
    if wt[n-1] > W: # nth item is bigger than knapsack's capacity
        return knapsack3(W , wt , val , n-1, False)
    else: # two cases : nth item included or excluded
        return max(val[n-1] + knapsack3(W-wt[n-1] , wt , val , n-1, False), 
                knapsack3(W , wt , val , n-1, False)) 



def minCoinChange(value, pieces, n=-1, init=True):
    """value : the sum to be returned - n : the number of pieces we can use"""
    if init: # init the memoization
        maxValue = 10000
        maxPieces = len(pieces)
        minCoinChange.dp = [ [-1 for i in range(maxPieces)] for j in range(maxValue) ]
    if n==-1: # init the number of pieces
        n=len(pieces)-1
    if minCoinChange.dp[value][n] != -1: # if set of params already computed
        return minCoinChange.dp[value][n]
    
    if n==0 or value==0:
        if value%pieces[0]!=0:
            return inf
        else:
            return value//pieces[0]
    elif value<0:
        return inf
    else:
        minCoinChange.dp[value][n] = min( minCoinChange(value-pieces[n], pieces, n, False)+1, minCoinChange(value, pieces, n-1, False) )
        return minCoinChange.dp[value][n]


def coinChange(value, pieces, n=-1, init=True):
    """value : the sum to be returned - n : the number of pieces we can use #OK"""
    if init: # init the memoization
        maxValue = 10000
        maxPieces = len(pieces)
        coinChange.dp = [ [-1 for i in range(maxPieces)] for j in range(maxValue) ]
    if n==-1: # init the number of pieces
        n=len(pieces)-1
    if coinChange.dp[value][n] != -1: # if set of params already computed
        return coinChange.dp[value][n]

    if n==0 or value==0:
        return 1
    elif value<0:
        return 0
    else:
        coinChange.dp[value][n] = coinChange(value-pieces[n], pieces, n, False) + coinChange(value, pieces, n-1, False)
        return coinChange.dp[value][n]



## ---------------------------------------------------------------------------

# primes
# levenstein
# convex hull

# for line in sys.stdin:
# sys.maxsize


# "{0:b}".format(37)
# returns a str of binary

'''
n, k = map(int, input().split())
days = list(map(int, input().split()))

'''

# from collections import Counter
# c = Counter(uneListe)

# sort map by value
# sorted(d.items(), key=lambda x: x[1])


# liste[0:10:2]
# defaultdic ??

# c.islower()


def binary_encode(i, num_digits):
    return np.array([i >> d & 1 for d in range(num_digits)])


def generate_primes(n:int) -> list:
    """Return primes in [0,n]."""
    if n<2:
        return []

    is_prime = [False, False] + [True]*(n-1)
    primes=[2]
    if n>=3: primes.append(3)

    for i in range(5, n+1, 6):
        if is_prime[i]:
            primes.append(i)
            j = i**2
            while j<=n:
                is_prime[j] = False
                j += (2*i)
        if i+2<=n and is_prime[i+2]==True:
            primes.append(i+2)
            j = (i+2)**2
            while j<=n:
                is_prime[j] = False
                j+=(2*i+4)
    
    return primes



## ---------------------------------------------------------------------------
@lru_cache(maxsize=128)  # store maxsize calls
def knapSack(W, wt, val, n): 
    if n == 0 or W == 0 : 
        return 0  
    if wt[n-1] > W:
        return knapSack(W, wt, val, n-1) 
    else: 
        return max(val[n-1] + knapSack(W-wt[n-1], wt, val, n-1), knapSack(W, wt, val, n-1)) 

## ---------------------------------------------------------------------------

if __name__ == "__main__":
    main()

