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 \in [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 \le t \le 2 \cdot 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 \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$.


-----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 \rightarrow 23 \rightarrow 32 \rightarrow 42$ (add $10$, add $9$, add $10$).

In the third test case of the example, the following sequence of moves can be applied: $18 \rightarrow 10 \rightarrow 4$ (subtract $8$, subtract $6$).

Difficulty: EASY
Tags: Mathematics

Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		c = abs(a - b)
		if c % 10 == 0:
			print(c // 10)
		else:
			c = c // 10 + 1
			print(c)


def solve():
	(a, b) = map(int, input().split())
	c = abs(b - a)
	k = 0
	k += c // 10
	if c % 10 != 0:
		k += 1
	print(k)
for _ in range(int(input())):
	solve()


import math
t = int(input())
while t:
	t = t - 1
	(a, b) = map(int, input().split())
	print(math.ceil(abs(a - b) / 10))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	dif = abs(a - b)
	print((dif + 9) // 10)


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


t = int(input())
for i in range(t):
	ab = input()
	ab = ab.split()
	a = int(ab[0])
	b = int(ab[1])
	if b - a > 0 and (a - b) % 2 != 0:
		print(1)
	elif b - a > 0 and (a - b) % 2 == 0:
		print(2)
	elif b - a < 0 and (a - b) % 2 == 0:
		print(1)
	elif b - a < 0 and (a - b) % 2 != 0:
		print(2)
	elif a - b == 0:
		print(0)


import bisect
import collections
import functools
import itertools
import math
import heapq
import random
import string

def repeat(_func=None, *, times=1):

	def decorator(func):

		@functools.wraps(func)
		def wrapper(*args, **kwargs):
			for _ in range(times):
				func(*args, **kwargs)
		return wrapper
	if _func is None:
		return decorator
	else:
		return decorator(_func)

def unpack(func=int):
	return map(func, input().split())

def l_unpack(func=int):
	return list(map(func, input().split()))

def s_unpack(func=int, rev=False):
	return sorted(map(func, input().split()), reverse=rev)

def ml_unpack(n):
	return [int(input()) for _ in range(n)]

def range_n():
	return range(int(input()))

def getint():
	return int(input())

def factor(n):
	d = {}
	while not n % 2:
		d[2] = d.get(2, 0) + 1
		n //= 2
	i = 3
	while i * i <= n:
		while not n % i:
			d[i] = d.get(i, 0) + 1
			n //= i
		i += 2
	if n > 1:
		d[n] = d.get(n, 0) + 1
	return d

def get_sum(a):
	ans = 0
	n = len(a)
	for i in range(n):
		ans += (i - (n - i - 1)) * a[i]
	return ans

@repeat(times=getint())
def main():
	(a, b) = unpack()
	if a == b:
		print(0)
	elif a < b:
		b -= a
		ans = b // 10
		ans += 1 if b % 10 else 0
		print(ans)
	else:
		a -= b
		ans = a // 10
		ans += 1 if a % 10 else 0
		print(ans)
main()


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


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	import math
	print(math.ceil(abs(a - b) / 10))


T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split(' '))
	c = 0
	if a < b:
		if a % 2 != 0 and b % 2 == 0:
			c = 1
		if a % 2 != 0 and b % 2 != 0:
			c = 2
		if a % 2 == 0 and b % 2 == 0:
			c = 2
		if a % 2 == 0 and b % 2 != 0:
			c = 1
	if a > b:
		if a % 2 != 0 and b % 2 == 0:
			c = 2
		if a % 2 != 0 and b % 2 != 0:
			c = 1
		if a % 2 == 0 and b % 2 == 0:
			c = 1
		if a % 2 == 0 and b % 2 != 0:
			c = 2
	if a == b:
		c = 0
	print(c)


from math import ceil
for ii in range(int(input())):
	(n, m) = map(int, input().split())
	dif = ceil(abs(n - m) / 10)
	print(dif)


from math import ceil
t = int(input())
while t != 0:
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	print(ceil((a - b) / 10))
	t -= 1


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


t = int(input())
while t > 0:
	x = input().split()
	a = int(x[0])
	b = int(x[1])
	ans = abs(a - b)
	curr = ans // 10
	if ans % 10 != 0:
		curr += 1
	print(curr)
	t -= 1


import math
from collections import defaultdict
for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	if a == b:
		print(0)
	else:
		s = 0
		k = abs(b - a)
		a10 = k % 10
		s += k // 10
		k = a10
		a9 = k % 9
		s += k // 9
		k = a9
		a8 = k % 8
		s += k // 8
		k = a8
		a7 = k % 7
		s += k // 7
		k = a7
		a6 = k % 6
		s += k // 6
		k = a6
		a5 = k % 5
		s += k // 5
		k = a5
		a4 = k % 4
		s += k // 4
		k = a4
		a3 = k % 3
		s += k // 3
		k = a3
		a2 = k % 2
		s += k // 2
		k = a2
		a1 = k % 1
		s += k // 1
		k = a1
		print(s)


t = int(input())
import math
while t > 0:
	(n, m) = map(int, input().split())
	print(math.ceil(abs(n - m) / 10))
	t -= 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	c1 = c // 10
	if c % 10:
		c1 += 1
	print(c1)


def fun(a, b):
	if b == a:
		return 0
	if a > b:
		(a, b) = (b, a)
	diff = b - a
	if diff % 10 == 0:
		return diff // 10
	else:
		return diff // 10 + 1
t = int(input())
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	print(fun(a, b))


t = int(input())
k = [i for i in range(1, 10)]
k.sort(reverse=True)
for _ in range(t):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	cnt = 0
	if c % 10 == 0:
		cnt = c // 10
	else:
		cnt = c // 10 + 1
	print(cnt)


def func(lista_de_tuplas):
	for i in range(len(lista_de_tuplas)):
		a = lista_de_tuplas[i][0]
		b = lista_de_tuplas[i][1]
		moves = 0
		if a > b and (a - b) % 2 == 0 or (a < b and (b - a) % 2 != 0):
			print('1')
		elif lista_de_tuplas[i][0] == lista_de_tuplas[i][1]:
			print('0')
		else:
			print('2')

def ask_for_numbers(n):
	lista_de_tuplas = []
	for i in range(n):
		lista_de_tuplas.append(tuple((int(el) for el in input().strip().split(' '))))
	return lista_de_tuplas

def main():
	func(ask_for_numbers(int(input())))
main()


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


import sys, math, collections
from collections import defaultdict

def file():
	sys.stdin = open('input.py', 'r')
	sys.stdout = open('output.py', 'w')

def get_array():
	l = list(map(int, input().split()))
	return l

def get_2_ints():
	(a, b) = map(int, input().split())
	return (a, b)

def get_3_ints():
	(a, b, c) = map(int, input().split())
	return (a, b, c)

def sod(n):
	(n, c) = (str(n), 0)
	for i in n:
		c += int(i)
	return c

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def getFloor(A, x):
	(left, right) = (0, len(A) - 1)
	floor = -1
	while left <= right:
		mid = (left + right) // 2
		if A[mid] == x:
			return A[mid]
		elif x < A[mid]:
			right = mid - 1
		else:
			floor = A[mid]
			left = mid + 1
	return floor

def chk(l, n):
	s = 0
	o = 0
	for i in range(len(l)):
		s += l[i]
		if s > n:
			return 0
		if s == n:
			ind = i
			o = 1
			break
	if o:
		return sum(l[ind + 1:]) == n

def main():
	for tt in range(int(input())):
		(a, b) = get_2_ints()
		if a > b:
			n = a - b
		elif a < b:
			n = b - a
		else:
			n = 0
		c = 0
		while n != 0:
			if n >= 10:
				t = n // 10
				n = n - t * 10
				c += t
			elif n >= 9:
				t = n // 9
				n = n - t * 9
				c += t
			elif n >= 8:
				t = n // 8
				n = n - t * 8
				c += t
			elif n >= 7:
				t = n // 7
				n = n - t * 7
				c += t
			elif n >= 6:
				t = n // 6
				n = n - t * 6
				c += t
			elif n >= 5:
				t = n // 5
				n = n - t * 5
				c += t
			elif n >= 4:
				t = n // 4
				n = n - t * 4
				c += t
			elif n >= 3:
				t = n // 3
				n = n - t * 3
				c += t
			elif n >= 2:
				t = n // 2
				n = n - t * 2
				c += t
			elif n >= 1:
				t = n // 1
				n = n - t * 1
				c += t
		print(c)
main()


t = int(input())
while t:
	(a, b) = map(int, input().split())
	rem = max(a, b) - min(a, b)
	if rem % 10 == 0:
		ans = rem // 10
	else:
		ans = rem // 10 + 1
	print(ans)
	t -= 1


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	v = diff / 10
	if v > int(v):
		result = int(v) + 1
		print(int(result))
	else:
		print(int(v))


t = int(input())
a = []
b = []
for i in range(t):
	xx = input().split()
	a.append(int(xx[0]))
	b.append(int(xx[1]))
for i in range(t):
	dif = a[i] - b[i]
	if dif == 0:
		print(0)
	elif dif > 0:
		if dif % 2 == 1:
			print(2)
		else:
			print(1)
	elif dif % 2 == 1:
		print(1)
	else:
		print(2)


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


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	diff = abs(b - a)
	ans = diff // 10
	if diff % 10:
		ans += 1
	print(ans)


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def solve():
	(a, b) = map(int, input().split())
	(x, y) = (min(a, b), max(a, b))
	y -= x
	ans = y // 10 if y % 10 == 0 else y // 10 + 1
	print(ans)
for _ in range(int(input())):
	solve()


import sys
input = lambda : sys.stdin.readline().rstrip()
from collections import deque
from queue import LifoQueue
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = abs(b - a)
	ans = 0
	ans += c // 10
	if c % 10 != 0:
		ans += 1
	print(ans)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	else:
		(c, d) = divmod(abs(b - a), 10)
		if d != 0:
			print(c + 1)
		else:
			print(c)


rw = int(input())
for wewq in range(rw):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	print((d + 9) // 10)


def solve():
	num = int(input())
	while num > 0:
		num -= 1
		(a, b) = map(int, input().split())
		depth = 0
		while a != b:
			if (b - a) // 10 > 0:
				temp = (b - a) // 10
				a += 10 * temp
				depth += temp
			elif -((a - b) // 10) // 10 < 0:
				temp = -((a - b) // 10)
				a += 10 * temp
				depth -= temp
			else:
				a += b - a
				depth += 1
		print(depth)
solve()


import sys
input = sys.stdin.readline

def print(val):
	sys.stdout.write(str(val) + '\n')

def prog():
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		if a == b:
			print(0)
		else:
			if a < b:
				(a, b) = (b, a)
			print((a - b + 9) // 10)
prog()


T = int(input())
ret = []
for t in range(T):
	(a, b) = map(int, input().split())
	ans = abs(a - b) // 10
	if abs(a - b) % 10 != 0:
		ans += 1
	ret.append(ans)
for t in range(T):
	print(ret[t])


N = int(input())
Ans = []
for i in range(N):
	(a, b) = map(int, input().split())
	if abs(b - a) % 10 == 0:
		Ans.append(abs(b - a) // 10)
	else:
		Ans.append(abs(b - a) // 10 + 1)
for i in Ans:
	print(i)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ans = abs(a - b) // 10
	if abs(a - b) % 10 > 0:
		ans += 1
	print(ans)


num = int(input())
for i in range(num):
	ab = list(map(int, input().split()))
	a = ab[0]
	b = ab[1]
	dis = b - a
	if dis == 0:
		print(0)
	elif dis == 1:
		print(1)
	elif dis < 0:
		if dis % 2 == 0:
			print(1)
		else:
			print(2)
	elif dis > 0:
		if dis % 2 == 1:
			print(1)
		else:
			print(2)


import sys
import math
import heapq
import collections
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')

def printspace(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer(' ')

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

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

def inputstring():
	return [x for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	(a, b) = inputnums()
	if a == b:
		print(0)
	if a > b:
		if (a - b) % 2 == 0:
			print(1)
		else:
			print(2)
	if a < b:
		if (b - a) % 2 == 1:
			print(1)
		else:
			print(2)


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


tt = int(input())
while tt:
	tt -= 1
	k = list(map(int, input().split()))
	a = k[0]
	b = k[1]
	if a == b:
		print(int(0))
	if a < b and a % 2 == 0 and (b % 2 == 0):
		print(int(2))
	if a < b and a % 2 == 0 and (b % 2 != 0):
		print(int(1))
	if a < b and a % 2 != 0 and (b % 2 == 0):
		print(int(1))
	if a < b and a % 2 != 0 and (b % 2 != 0):
		print(int(2))
	if a > b and a % 2 == 0 and (b % 2 == 0):
		print(int(1))
	if a > b and a % 2 == 0 and (b % 2 != 0):
		print(int(2))
	if a > b and a % 2 != 0 and (b % 2 == 0):
		print(int(2))
	if a > b and a % 2 != 0 and (b % 2 != 0):
		print(int(1))


from math import gcd, ceil
N = int(input())
for i in range(N):
	l = list(map(int, input().split()))
	l.sort()
	(a, b) = l
	print(ceil((b - a) / 10))


t = int(input())
while t > 0:
	(a, b) = [int(x) for x in input().split()]
	temp = abs(a - b)
	if temp % 10 == 0:
		print(temp // 10)
	else:
		print(temp // 10 + 1)
	t -= 1


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
t = ini()
for _ in range(t):
	(a, b) = inm()
	tmp = abs(a - b)
	if tmp == 0:
		print(0)
	else:
		print((tmp + 9) // 10)


import math
t = int(input())
while t > 0:
	l = input().split()
	a = int(l[0])
	b = int(l[1])
	mov = math.ceil(math.fabs(b - a) / 10)
	print(mov)
	t = t - 1


import math
rr = lambda : input().strip()
rrm = lambda : map(int, rr().split())
T = int(rr())
for _ in range(T):
	(a, b) = rrm()
	ans = math.ceil(abs(a - b) / 10)
	print(ans)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		n = 0
	elif abs(a - b) <= 10:
		n = 1
	else:
		n = abs(a - b) // 10
		if abs(a - b) % 10 != 0:
			n += 1
	print(n)


tc = int(input())
flag = 0
for x in range(tc):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a < b and abs(a - b) % 2 != 0:
		print(1)
	elif a > b and (a - b) % 2 == 0:
		print(1)
	else:
		print(2)


n = int(input())
while n != 0:
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a < b:
		ans = b - a
		if ans % 2 != 0:
			print(1)
		else:
			print(2)
	else:
		ans = a - b
		if ans % 2 == 0:
			print(1)
		else:
			print(2)
	n = n - 1


t = int(input())
h = ''
for t in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		f = a - b
	else:
		f = b - a
	j = f // 10
	if f % 10 > 0:
		j += 1
	h += str(j) + '\n'
print(h[:-1])


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	print((a - b) // 10 + int(bool((a - b) % 10)))


w = int(input())
a = []
for i in range(w):
	p = input().split()
	a.append(p)
for i in range(w):
	r = a[i]
	if int(r[0]) < int(r[1]):
		if int(r[0]) % 2 != 0 and int(r[1]) % 2 == 0:
			print(1)
		elif int(r[0]) % 2 == 0 and int(r[1]) % 2 != 0:
			print(1)
		else:
			print(2)
	elif int(r[0]) > int(r[1]):
		if int(r[0]) % 2 == 0 and int(r[1]) % 2 == 0:
			print(1)
		elif int(r[0]) % 2 != 0 and int(r[1]) % 2 != 0:
			print(1)
		else:
			print(2)
	else:
		print(0)


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


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


from math import *
import sys
n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	print(d // 10 + (1 if d % 10 != 0 else 0))


import math
import collections
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect_left as bsl
from bisect import bisect_right as bsr
import heapq as hq
setrecursionlimit(2 ** 20)
t = 1
t = int(stdin.readline())
for _ in range(t):
	(a, b) = list(map(int, stdin.readline().rstrip().split()))
	(a, b) = (min(a, b), max(a, b))
	ans = 0
	ans += abs(a - b) // 10
	if (b - a) % 10 != 0:
		ans += 1
	print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	ans = abs(b - a) // 10
	if abs(b - a) % 10:
		ans += 1
	print(ans)


import re, math, decimal, bisect

def read():
	return input().strip()

def iread():
	return int(input().strip())

def viread():
	return [int(_) for _ in input().strip().split()]

def round(n):
	return int(n + 0.5)
DEBUG = 1

def debug(*args, **kwargs):
	if DEBUG:
		print(*args, **kwargs)
n = iread()
for _ in range(n):
	(a, b) = viread()
	if a == b:
		print(0)
	elif a > b:
		if (a - b) % 2 == 0:
			print(1)
		else:
			print(2)
	elif (b - a) % 2 == 0:
		print(2)
	else:
		print(1)


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	if x == y:
		print(0)
	elif x > y:
		if (x - y) % 2 == 0:
			print(1)
		else:
			print(2)
	elif (y - x) % 2 == 0:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	if diff % 10:
		print(diff // 10 + 1)
	else:
		print(diff // 10)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = abs(b - a)
	s = 0
	for i in range(10, 0, -1):
		s += c // i
		c = c - c // i * i
	print(s)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	if c % 10 == 0:
		print(c // 10)
	else:
		print(c // 10 + 1)


try:
	from sys import stdin, stdout
	import math
	t = int(stdin.readline())
	for _ in range(t):
		(a, b) = map(int, stdin.readline().split())
		if a == b:
			stdout.write('0' + '\n')
		else:
			diff = int(abs(a - b))
			if a > b:
				if diff & 1:
					stdout.write('2' + '\n')
				else:
					stdout.write('1' + '\n')
			elif a < b:
				if diff & 1:
					stdout.write('1' + '\n')
				else:
					stdout.write('2' + '\n')
except:
	pass


t = int(input())
for _ in range(t):
	(a, b) = [int(s) for s in input().split(' ')]
	if a == b:
		print(0)
	elif abs(b - a) % 10 == 0:
		print(abs(b - a) // 10)
	else:
		print(abs(b - a) // 10 + 1)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	dif = b - a
	if dif == 0:
		print(0)
		continue
	if dif % 2 == 0 and a > b or (dif % 2 == 1 and a < b):
		ans = 1
	if dif % 2 == 1 and a > b or (dif % 2 == 0 and a < b):
		ans = 2
	print(ans)


def solve():
	(a, b) = list(map(int, input().split()))
	diff = b - a
	if diff == 0:
		print(0)
	else:
		if diff < 0:
			diff = -diff
		if diff % 10 == 0:
			ans = int(diff / 10)
			print(ans)
		else:
			ans = int(diff / 10) + 1
			print(ans)
	return
t = int(input())
while t != 0:
	solve()
	t -= 1


import math
cases = int(input())
for t in range(cases):
	(a, b) = list(map(int, input().split()))
	diff = abs(a - b)
	output = math.ceil(diff / 10)
	print(output)


import sys
from collections import defaultdict as dd
from collections import Counter as cc
from queue import Queue
import math
import itertools
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = lambda : sys.stdin.buffer.readline().rstrip()
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	if (a - b) % 10 == 0:
		print((a - b) // 10)
	else:
		print((a - b) // 10 + 1)


import math
t = int(input())
for w in range(t):
	(a, b) = (int(i) for i in input().split())
	k = abs(b - a) // 10
	if abs(b - a) % 10 == 0:
		print(k)
	else:
		print(k + 1)


c = []
for i in range(int(input())):
	(a, b) = map(int, input().split())
	sum = 0
	sum += abs(a - b) // 10
	if abs(a - b) % 10 != 0:
		sum += 1
	c.append(sum)
for k in c:
	print(k)


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


for t in range(int(input())):
	(a, b) = sorted(map(int, input().split()))
	d = b - a
	ans = d // 10 + int(bool(d % 10))
	print(ans)


import sys
f_in = sys.stdin
f_out = sys.stdout
t = int(f_in.readline())
for i in range(0, t):
	numpair = f_in.readline().split()
	a = int(numpair[0])
	b = int(numpair[1])
	if a > b and (a - b) % 2 == 1:
		f_out.write('2\n')
	elif a > b and (a - b) % 2 == 0:
		f_out.write('1\n')
	elif a < b and (b - a) % 2 == 1:
		f_out.write('1\n')
	elif a < b and (b - a) % 2 == 0:
		f_out.write('2\n')
	else:
		f_out.write('0\n')


def thief():
	comb = input().split(' ')
	for i in range(4):
		for j in range(4):
			for l in range(4):
				for u in range(4):
					print(comb[i], comb[j], comb[l], comb[u])

def thief2():
	comb = input().split(' ')
	for i in range(4):
		for j in range(4):
			for l in range(4):
				for u in range(4):
					if j != i and j != l and (j != u) and (j != l) and (l != u):
						print(comb[i], comb[j], comb[l], comb[u])

def palindrome():
	string2 = ''
	string3 = ''
	string1 = input()
	string = []
	string[:] = string1
	for i in range(len(string)):
		string2 += string[len(string) - i - 1]
	if string2 == string1:
		print('yes')
	else:
		print('no')

def sort():
	list = input().split()
	bool1 = input('enter true for ascending order and false for descending order')
	if bool1 == 'true':
		list.sort()
	else:
		list.sort(reverse=True)
	print(list)

def sing():
	for i in range(10):
		print(10 - i, ' green bottles hanging on the wall ', 10 - i, ' green bottles hanging on the wall,And if one green bottle should accidentally fall,Therell be ', 10 - i - 1, ' green bottles hanging on the wall.')

def twoint():
	n = int(input())
	list1 = []
	for i in range(n):
		list1.append(input().split())
	for i in range(n):
		a = int(list1[i][0])
		b = int(list1[i][1])
		if a > b:
			if (a - b) % 10 == 0:
				print((a - b) // 10)
			else:
				print((a - b) // 10 + 1)
		elif (b - a) % 10 == 0:
			print((b - a) // 10)
		else:
			print((b - a) // 10 + 1)
twoint()


z = int(input())
for _ in range(z):
	ans = 0
	(x, y) = list(map(int, input().split()))
	if x == y:
		print(0)
	else:
		diff = abs(x - y)
		ans += int(diff / 10)
		if diff % 10 > 0:
			ans += 1
		print(ans)


T = int(input())
for t in range(T):
	s = input().split()
	a = int(s[0])
	b = int(s[1])
	diff = abs(a - b)
	result = 0
	result += diff // 10
	if diff % 10 > 0:
		result += 1
	print(result)


c = int(input())
for q in range(c):
	y = input()
	h = y.split(' ')
	for i in range(2):
		h[i] = int(h[i])
	a = h[0]
	b = h[1]
	if a == b:
		i = 0
	elif a > b:
		if a % 2 == b % 2:
			i = 1
		else:
			i = 2
	elif a < b:
		if a % 2 != b % 2:
			i = 1
		else:
			i = 2
	print(i)


def odd_even(a, b):
	if a == b:
		moves = 0
	elif abs(a - b) % 2 == 0:
		if a < b:
			moves = 2
		else:
			moves = 1
	elif a < b and abs(a - b) % 2 != 0:
		moves = 1
	else:
		moves = 2
	print(moves)
for _ in range(int(input().strip(' '))):
	(a, b) = tuple(map(int, input().strip(' ').split(' ')))
	odd_even(a, b)


tests = int(input())
for i in range(tests):
	(a, b) = map(int, input().split())
	c = abs(b - a)
	d = c // 10
	if d == 0 and c % 10 == 0:
		print(d)
	elif d == 0 and c % 10 != 0:
		print(d + 1)
	elif c % 10 == 0:
		print(d)
	else:
		d += 1
		print(d)


from sys import stdin
N = int(stdin.readline().rstrip())
for i in range(N):
	(a, b) = [int(x) for x in stdin.readline().rstrip().split()]
	if b - a == 0:
		print(0)
	elif b - a < 0:
		if (a - b) % 2 == 0:
			print(1)
		else:
			print(2)
	elif (b - a) % 2 == 0:
		print(2)
	else:
		print(1)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	ans = abs(b - a) // 10
	maxi = max(a, b)
	mini = min(a, b)
	if maxi - 10 * ans - mini != 0:
		ans += 1
	print(ans)


q = int(input())
while q:
	(a, b) = map(int, input().split())
	diff = a - b
	if diff == 0:
		print(0)
	elif diff < 0:
		if diff % 2 == 0:
			print(2)
		else:
			print(1)
	elif diff % 2 == 0:
		print(1)
	else:
		print(2)
	q -= 1


import math

def inp():
	return int(input())

def insr():
	s = input()
	return s

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

def f(a, b):
	return math.ceil((max(a, b) - min(a, b)) / 10)
r = inp()
for i in range(r):
	l2 = inlt()
	print(f(l2[0], l2[1]))


import math
for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		c = abs(a - b)
		d = math.ceil(c / 10)
		print(d)


t = int(input())
while t > 0:
	(a, b) = [int(y) for y in input().split()]
	x = abs(b - a) // 10
	if abs(b - a) % 10 > 0:
		x += 1
	print(x)
	t -= 1


a = int(input())
ans = []
for i in range(0, a):
	b = input()
	c = [int(x) for x in b.split()]
	selisih = c[0] - c[1]
	if selisih < 0:
		if selisih % 2 == 0:
			ans.append(2)
		elif selisih % 2 == 1:
			ans.append(1)
	elif selisih > 0:
		if selisih % 2 == 0:
			ans.append(1)
		elif selisih % 2 == 1:
			ans.append(2)
	else:
		ans.append(0)
for j in range(0, a):
	print(ans[j])


n = int(input())
for i in range(n):
	a = input().split()
	b = int(a[1])
	a = int(a[0])
	aux = (b - a + 9) / 10 if a <= b else (a - b + 9) / 10
	print(int(aux))


t = int(input())
while t:
	(x, y) = map(int, input().split())
	print(0 if x == y else 1 + int((x < y) ^ x - y & 1))
	t -= 1


import os
import sys
from io import BytesIO, IOBase

def solution(a, b):
	if a == b:
		write(0)
		return
	diff = abs(a - b)
	res = diff // 10
	write(res if diff % 10 == 0 else res + 1)

def main():
	for _ in range(r_int()):
		(a, b) = r_array()
		solution(a, b)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(str(args[-1]))
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


t = int(input())
z = []
for i in range(0, t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if b >= a:
		s = b - a
		if s == 0:
			q = 0
			z.append(q)
		elif s % 2 == 0:
			q = 2
			z.append(q)
		else:
			q = 1
			z.append(q)
	elif a > b:
		s = a - b
		if s % 2 == 0:
			q = 1
			z.append(q)
		else:
			q = 2
			z.append(q)
for i in z:
	print(i)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	otv = 0
	r = abs(a - b)
	otv += r // 10
	r = r % 10
	otv += r // 9
	r = r % 9
	otv += r // 8
	r = r % 8
	otv += r // 7
	r = r % 7
	otv += r // 6
	r = r % 6
	otv += r // 5
	r = r % 5
	otv += r // 4
	r = r % 4
	otv += r // 3
	r = r % 3
	otv += r // 2
	r = r % 2
	otv += r // 1
	r = r % 1
	print(otv)


T = int(input())
while T > 0:
	(a, b) = map(int, input().split())
	res = 0
	if a > b:
		temp = a - b
		res += temp // 10
		if temp % 10 != 0:
			res += 1
	else:
		temp = b - a
		res += temp // 10
		if temp % 10 != 0:
			res += 1
	print(res)
	T -= 1


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 (b - a) % 2 == 1:
			print(1)
		else:
			print(2)
	elif (b - a) % 2 == 0:
		print(1)
	else:
		print(2)


for i in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	x = abs(b - a) + 9
	print(x // 10)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	n = a + (b - a) // 10 * 10
	if n == b:
		print((b - a) // 10)
	else:
		print((b - a) // 10 + 1)


for t in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	s = 0
	(a, b) = (min(b, a), max(b, a))
	m = b - a
	s = s + m // 10
	a = a + m // 10 * 10
	if a == b:
		print(s)
	else:
		print(s + 1)


t = int(input())
for _ in range(t):
	ar = list(map(int, input().split()))
	d = abs(ar[0] - ar[1])
	if d % 10 == 0:
		print(d // 10)
	else:
		print(d // 10 + 1)


import math, sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
li = lambda : list(map(int, input().split()))

def solve():
	(a, b) = li()
	if a == b:
		print(0)
	elif (b - a) % 2 == 0 and b > a:
		print(2)
	elif (b - a) % 2 != 0 and b > a:
		print(1)
	elif (b - a) % 2 != 0 and b < a:
		print(2)
	elif (b - a) % 2 == 0 and b < a:
		print(1)
for _ in range(int(input())):
	solve()


import sys, bisect
from sys import stdin, stdout
from bisect import bisect_left, bisect_right, bisect, insort, insort_left, insort_right
from math import gcd, ceil, floor, sqrt
from collections import Counter, defaultdict, deque, OrderedDict
from queue import Queue, PriorityQueue
from string import ascii_lowercase
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 998244353
mod = 10 ** 9 + 7

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	for i in range(5, ceil(sqrt(n)) + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def solve():
	(a, b) = mp()
	x = abs(a - b)
	print(ceil(x / 10))
for _ in range(inp()):
	solve()


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


n = int(input())
for i in range(n):
	(start, finish) = map(int, input().split())
	dist = finish - start
	if dist < 0:
		dist *= -1
	res = dist // 10
	if dist % 10 != 0:
		res += 1
	print(res)


tests = int(input())
for i in range(tests):
	vals = input().split(' ')
	a = int(vals[0])
	b = int(vals[1])
	d = abs(a - b)
	if d % 10 == 0:
		print(d // 10)
	else:
		print(d // 10 + 1)


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


for _ in range(int(input())):
	l = list(map(int, input().split()))
	a = l[0]
	b = l[1]
	if b > a:
		(a, b) = (b, a)
	x = a - b
	if x % 10 == 0:
		print(int(x / 10))
	else:
		print(x // 10 + 1)


import math
a = int(input())
b = []
for i in range(a):
	(c, d) = map(int, input().split())
	c = abs(c - d) / 10
	c = math.ceil(c)
	b.append(c)
for i in range(a):
	print(b[i])


c = []
for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		if a % 2 == 0 and b % 2 == 0 or (a % 2 == 1 and b % 2 == 1):
			c.append('2')
		if a % 2 == 1 and b % 2 == 0 or (a % 2 == 0 and b % 2 == 1):
			c.append('1')
	if a > b:
		if a % 2 == 0 and b % 2 == 0 or (a % 2 == 1 and b % 2 == 1):
			c.append('1')
		if a % 2 == 1 and b % 2 == 0 or (a % 2 == 0 and b % 2 == 1):
			c.append('2')
	if a == b:
		c.append('0')
for i in c:
	print(i)


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


q = int(input())
for _ in range(q):
	[a, b] = list(map(int, input().split()))
	c = int(0)
	if a > b:
		c = a - b
	else:
		c = b - a
	if c % 10 == 0:
		ans = int(c / 10)
		print(ans)
	else:
		ans = int(c / 10)
		ans = ans + 1
		print(ans)


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


from math import *

def binarySearch(arr, x, i):
	l = i
	r = len(arr) - 1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def js(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] <= x:
			ans = m
			l = m + 1
		else:
			r = m - 1
	return ans

def jg(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] >= x:
			ans = m
			r = m - 1
		else:
			l = m + 1
	return ans

def ceil(a, b):
	if a % b == 0:
		return int(a / b)
	else:
		return a // b + 1
for __ in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		if (b - a) % 2 == 1:
			print(1)
		else:
			print(2)
	elif a > b:
		if (a - b) % 2 == 0:
			print(1)
		else:
			print(2)
	else:
		print(0)


for _ in range(int(input())):
	(a, b) = (int(i) for i in input().split(' '))
	c = abs(b - a)
	if c // 10 == c / 10:
		print(c // 10)
	else:
		print(c // 10 + 1)


from math import gcd
from collections import defaultdict
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	if a == b:
		print(0)
	else:
		r = (a - b) % 10
		if r == 0:
			print((a - b) // 10)
		else:
			print((a - b) // 10 + 1)


n = int(input())
for x in range(n):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	print((max(a, b) - min(a, b)) // 10 + (1 if (max(a, b) - min(a, b)) % 10 != 0 else 0))


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


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	d = int(abs(a - b))
	if d % 10 == 0:
		print(int(d / 10))
	else:
		print(int(1 + d / 10))
	t = t - 1


for _ in range(int(input())):
	a = list(map(int, input().split()))
	b = abs(a[0] - a[1])
	c = b // 10
	d = b % 10
	if d:
		d = 1
	print(c + d)


n = int(input())
for i in range(n):
	k = list(map(int, input().strip().split()))
	if k[0] >= k[1]:
		c = 0
		a = []
		if k[0] - k[1] <= 10 and k[1] != k[0]:
			print(1)
		if k[1] - k[0] <= 10 and k[1] == k[0]:
			print(0)
		if k[0] - k[1] > 10:
			t = k[0] - k[1]
			p = t % 10
			z = k[0] - p
			l = z - k[1]
			if l + k[1] == k[0]:
				print(l // 10)
			else:
				print(l // 10 + 1)
	if k[1] > k[0]:
		c = 0
		a = []
		if k[1] - k[0] <= 10 and k[0] != k[1]:
			print(1)
		if k[1] - k[0] > 10:
			t = k[1] - k[0]
			p = t % 10
			z = k[1] - p
			l = z - k[0]
			if l + k[0] == k[1]:
				print(l // 10)
			else:
				print(l // 10 + 1)


I = input
t = int(I())
y = 0

def solved(a, b):
	if a == b:
		return 0
	m = 0
	while 1:
		m += 1
		if b > a:
			if (b - a) % 2 != 0:
				xy = b - a
				a = a + xy
			else:
				xy = 1
				a = a + xy
		elif (a - b) % 2 == 0:
			xy = a - b
			a = a - xy
		else:
			xy = 1
			a = a + xy
		if a == b:
			return m
sol = []
for i in range(t):
	tx = I().split(' ')
	a = tx[0]
	b = tx[1]
	sol.append(solved(int(a), int(b)))
for s in sol:
	print(s)


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


T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split())
	cnt = 0
	if a > b:
		cnt += (a - b) // 10
		if (a - b) % 10:
			cnt += 1
	elif a < b:
		cnt += (b - a) // 10
		if (b - a) % 10:
			cnt += 1
	print(cnt)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	count = 0
	if a == b:
		print(0)
	else:
		diff = abs(a - b)
		if diff < 10:
			count = 1
		elif diff % 10 != 0:
			count = diff // 10
			count += 1
		else:
			count = diff // 10
		print(count)


def solve():
	inpu = list(map(int, input().strip().split()))
	(a, b) = (inpu[0], inpu[1])
	if a == b:
		print(0)
		return 0
	elif b > a:
		count = 0
		ten = int((b - a) / 10)
		a = a + ten * 10
		count += ten
		if a == b:
			print(count)
			return 0
		a = a + (b - a)
		count += 1
		print(count)
		return 0
	elif a > b:
		count = 0
		ten = int((a - b) / 10)
		a = a - ten * 10
		count += ten
		if a == b:
			print(count)
			return 0
		a = a - (a - b)
		count += 1
		print(count)
		return 0
t = int(input())
while t > 0:
	solve()
	t -= 1


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(math.ceil(abs(b - a) / 10))


def read_array():
	x = []
	x1 = []
	x = input()
	x = x.split(' ')
	for r in range(len(x)):
		x1.append(int(x[r]))
	return x1

def number(a, b):
	if a == b:
		return 0
	if a < b:
		if a % 2 == 0:
			if b % 2 == 0:
				return 2
			else:
				return 1
		elif b % 2 == 0:
			return 1
		else:
			return 2
	elif a % 2 == 0:
		if b % 2 == 0:
			return 1
		else:
			return 2
	elif b % 2 == 0:
		return 2
	else:
		return 1
m = int(input())
res = []
for k in range(m):
	x = read_array()
	res.append(number(x[0], x[1]))
for v in res:
	print(v)


n = int(input())
answer = []
data = []
for i in range(0, n):
	data = list(map(int, input().split()))
	if data[1] - data[0] == 0:
		answer.append(0)
	if data[1] - data[0] > 0 and (data[1] - data[0]) % 2 == 0:
		answer.append(2)
	if data[1] - data[0] > 0 and (data[1] - data[0]) % 2 == 1:
		answer.append(1)
	if data[1] - data[0] < 0 and (data[1] - data[0]) % 2 == 0:
		answer.append(1)
	if data[1] - data[0] < 0 and (data[1] - data[0]) % 2 == 1:
		answer.append(2)
for i in range(len(answer)):
	print(answer[i])


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


def func(a, b):
	ans = 0
	temp = abs(a - b)
	if a > b:
		if temp % 2 == 0:
			ans = 1
		else:
			ans = 2
	elif b > a:
		if temp % 2 != 0:
			ans = 1
		else:
			ans = 2
	return ans
t = int(input())
while t:
	t -= 1
	k = [int(i) for i in input().split(' ')]
	(a, b) = (k[0], k[1])
	print(func(a, b))


def main():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		diff = abs(a - b)
		moves = int(diff / 10)
		diff = diff % 10
		if diff > 0:
			moves += 1
		print(moves)
main()


import sys
input = lambda : sys.stdin.readline().rstrip()
for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		if (b - a) % 2 == 1:
			print(1)
		else:
			print(2)
	elif a > b:
		if (a - b) % 2 == 1:
			print(2)
		else:
			print(1)
	else:
		print(0)


import math
t = int(input())
answer = list()
for test_case in range(t):
	a = input()
	a = a.split()
	b = int(a[1])
	a = int(a[0])
	answer.append(math.ceil(abs(a - b) / 10))
for i in answer:
	print(i)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	x = abs(b - a)
	an = x // 10 + int(x % 10 != 0)
	print(an)


import math
cases = int(input(''))
output = []
for case in range(cases):
	x = input('').split()
	list1 = []
	counter = 0
	for c in range(len(x)):
		list1.append(int(x[c]))
	list1.sort()
	if list1[0] == list1[1]:
		output.append(0)
		continue
	else:
		result = math.ceil((list1[1] - list1[0]) / 10)
		output.append(result)
print(*output, sep='\n')


t = int(input())
ans = []
for i in range(t):
	(a, b) = map(int, input().split())
	out = ''
	if a == b:
		out = '0'
	elif a < b:
		if (a - b) % 2 == 1:
			out = '1'
		else:
			out = '2'
	elif (a - b) % 2 == 0:
		out = '1'
	else:
		out = '2'
	ans.append(out)
print('\n'.join(ans))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		diff = max(a, b) - min(a, b)
		print((diff - 1) // 10 + 1)


import math
t = int(input())
result = []
for i in range(t):
	counter = 0
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	if a == b:
		result.append(0)
	else:
		counter = math.ceil(abs(a - b) / 10)
		result.append(counter)
for i in range(t):
	print(result[i])


t = int(input())
for i in range(t):
	(m, n) = map(int, input().strip().split())
	if m == n:
		print(0)
	else:
		res = abs(m - n)
		if res % 10 == 0:
			print(res // 10)
		else:
			print(res // 10 + 1)


from math import ceil
n = int(input())
ans = []
for i in range(n):
	(a, b) = [int(i) for i in input().split()]
	ans.append(ceil(abs(a - b) / 10))
for i in ans:
	print(i)


t = int(input())
for test in range(t):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	n = x // 10
	if x % 10 != 0:
		n += 1
	print(n)


for i in [0] * int(input()):
	(a, b) = map(int, input().split())
	if a > b:
		if (a + b) % 2 == 0:
			print('1')
		else:
			print('2')
	elif b > a:
		if (a + b) % 2 == 0:
			print('2')
		else:
			print('1')
	else:
		print('0')


import math

def solve():
	(a, b) = [int(v) for v in input().split()]
	print(math.ceil(abs(a - b) / 10))
t = int(input())
for _ in range(t):
	solve()


import math

def solve():
	(a, b) = map(int, input().split())
	print(int(math.ceil(abs(a - b) / 10)))
T = int(input())
for _ in range(T):
	solve()


n = int(input())
for i in range(n):
	nums = [int(n) for n in input().split()]
	a = nums[0]
	b = nums[1]
	if a < b:
		if (b - a) % 2 != 0:
			print(1)
		else:
			print(2)
	elif a > b:
		if (a - b) % 2 == 0:
			print(1)
		else:
			print(2)
	else:
		print(0)


test = int(input())
for i in range(test):
	(x, y) = map(int, input().split())
	c = 0
	if abs(x - y) <= 10 and abs(x - y) != 0:
		print(1)
	elif abs(x - y) == 0:
		print(0)
	else:
		if abs(x - y) % 10 == 0:
			c = abs(x - y) // 10
		else:
			c = abs(x - y) // 10
			c += 1
		print(c)


t = int(input())
while t > 0:
	t = t - 1
	(a, b) = [int(i) for i in input().split()]
	if a == b:
		ans = 0
	else:
		diff = abs(b - a)
		coeff = diff // 10
		if diff == 10 * coeff:
			ans = coeff
		else:
			ans = coeff + 1
	print(ans)


t = int(input())
for i in range(t):
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	if n == m:
		print(0)
	elif n < m:
		if (m - n) % 2 == 1:
			print(1)
		else:
			print(2)
	elif (n - m) % 2 == 1:
		print(2)
	else:
		print(1)


for i in range(int(input())):
	(a, b) = sorted(map(int, input().split()))
	s = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
	c = b - a
	cnt = 0
	for i in s:
		cnt = c // i
		c -= c // i
	print(cnt)


line_no = int(input())
for index in range(line_no):
	s = input()
	(a, b) = s.split(' ')
	x = int(a) - int(b)
	if x > 0:
		if x % 2 == 0:
			print(1)
		else:
			print(2)
	elif x < 0:
		if x % 2 != 0:
			print(1)
		else:
			print(2)
	else:
		print(0)


import math
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	st = 0
	if a > b:
		st = a - b
	else:
		st = b - a
	ans = st / 10
	print(math.ceil(ans))


T = int(input())
for z in range(T):
	(a, b) = [int(x) for x in input().split()]
	diss = abs(a - b)
	steps = diss // 10
	if diss % 10 != 0:
		steps += 1
	print(steps)


import sys

class AYetAnotherTwoIntegersProblem:

	def solve(self, tc=0):
		for _ in range(int(input())):
			(a, b) = [int(_) for _ in input().split()]
			print(abs(b - a) // 10 + int(abs(b - a) % 10 != 0))
solver = AYetAnotherTwoIntegersProblem()
input = sys.stdin.readline
solver.solve()


import math
K = int(input())
T = []
for i in range(0, K):
	a = input()
	b = int(a.split(' ')[0])
	c = int(a.split(' ')[1])
	T.append(math.ceil(abs(c - b) / 10))
for i in T:
	print(i)


import math
testcases = int(input())
while testcases:
	testcases -= 1
	(a, b) = map(int, input().split())
	if a == b:
		print('0')
	else:
		moves = 0
		while a != b:
			if a < b:
				diff = b - a
				if diff % 2 != 0:
					a += diff
				else:
					a += diff - 1
			else:
				diff = a - b
				if diff % 2 == 0:
					a -= diff
				else:
					a -= diff + 1
			moves += 1
		print(moves)


n = int(input())
resp = []
for i in range(n):
	valores = [int(i) for i in input().split()]
	dif = max(valores) - min(valores)
	if dif % 10 == 0:
		pasosj = dif // 10
	else:
		pasosj = dif // 10 + 1
	resp.append(pasosj)
for i in range(n):
	print(resp[i])


import sys
t = int(input())
for i in range(t):
	ab = sys.stdin.readline().strip().split(' ')
	a = int(ab[0])
	b = int(ab[1])
	x = b - a
	if x > 0 and x % 2 == 0:
		print(2)
	elif x < 0 and x % 2 == 1:
		print(2)
	elif x == 0:
		print(0)
	else:
		print(1)


import math
t = int(input().strip())
for _ in range(t):
	(a, b) = map(int, input().strip().split())
	diff = abs(a - b)
	ans = 0
	if diff == 0:
		ans = 0
	else:
		ans = math.ceil(diff / 10)
	print(ans)


t = int(input())
while t > 0:
	t -= 1
	(a, b) = [int(i) for i in input().split()]
	diff = abs(a - b)
	if diff == 0:
		print(0)
		continue
	count = diff // 10
	if diff % 10 != 0:
		count += 1
	print(count)


t = int(input())
while t:
	t -= 1
	line = input().split()
	a = int(line[0])
	b = int(line[1])
	if a == b:
		print(0)
	elif a < b:
		if a % 2 == b % 2:
			print(2)
		else:
			print(1)
	elif a % 2 == b % 2:
		print(1)
	else:
		print(2)


total = int(input())
for i in range(total):
	a_b = input().split()
	a = int(a_b[0])
	b = int(a_b[1])
	if a == b:
		print(0)
	elif b > a and b % 2 != a % 2:
		print(1)
	elif b < a and b % 2 == a % 2:
		print(1)
	elif b > a and b % 2 == a % 2:
		print(2)
	elif b < a and b % 2 != a % 2:
		print(2)


T = int(input())

def main():
	(a, b) = tuple(map(int, input().split()))
	if a == b:
		return 0
	diff = abs(a - b)
	if diff % 10 == 0:
		return diff // 10
	else:
		return diff // 10 + 1
for _ in range(T):
	print(main())


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


def main():
	t = int(input())
	for i in range(t):
		(a, b) = map(int, input().split())
		result = find_min_cost_to_transform(a, b, max_k=10)
		print(result)

def find_min_cost_to_transform(a, b, max_k):
	distance = abs(b - a)
	if distance == 0:
		return 0
	return 1 + (distance - 1) // max_k
main()


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if x == y:
		print(0)
		continue
	if y > x:
		if x % 2 == 0 and y % 2 == 0:
			print(2)
		if x % 2 == 0 and y % 2 != 0:
			print(1)
		if x % 2 != 0 and y % 2 == 0:
			print(1)
		if x % 2 != 0 and y % 2 != 0:
			print(2)
	if x > y:
		if x % 2 == 0 and y % 2 == 0:
			print(1)
		if x % 2 == 0 and y % 2 != 0:
			print(2)
		if x % 2 != 0 and y % 2 == 0:
			print(2)
		if x % 2 != 0 and y % 2 != 0:
			print(1)


from sys import stdin, stdout
test = int(stdin.readline())
for _ in range(test):
	(a, b) = map(int, stdin.readline().split())
	ans = abs(b - a) // 10 + int(abs(b - a) % 10 != 0)
	print(ans)


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	c = b - a
	q = 0
	if c < 0:
		(a, b) = (b, a)
		c = -c
	k = 0
	if c == 0:
		print('0')
	else:
		q = c // 10
		r = c % 10
		if r > 0:
			print(q + 1)
		else:
			print(q)
	t = t - 1


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


def nod(a, b):
	while a != b:
		(a, b) = (max(a, b), min(a, b))
		if a % b == 0:
			a -= (a // b - 1) * b
		else:
			a -= a // b * b
	return a
for t in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	if a == b:
		print(0)
	elif a % 2 != b % 2 and a > b or (a % 2 == b % 2 and a < b):
		print(2)
	else:
		print(1)


def result():
	(c, d) = input().split()
	c = int(c)
	d = int(d)
	a = min(c, d)
	b = max(c, d)
	count = 0
	while not a == b:
		diff = b - a
		if diff > 10:
			count = diff // 10
			a = count * 10 + a
		j = 10
		for i in range(0, 10):
			if a + j > b:
				j = j - 1
				continue
			a = a + j
			count = count + 1
	print(count)
t = int(input())
while t > 0:
	result()
	t = t - 1


def minstep(a, b):
	step = 0
	if a > b:
		step = (a - b) // 10
		if (a - b) % 10 != 0:
			step += 1
	elif a == b:
		pass
	else:
		step = (b - a) // 10
		if (b - a) % 10 != 0:
			step += 1
	print(step)
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	minstep(a, b)


t = int(input())
for i in range(t):
	(n, s) = input().split()
	s = int(s)
	n = int(n)
	res = int(abs(n - s))
	rem = int(res % 10)
	if rem != 0:
		rem = 1
	ans = int(res / 10 + rem)
	print(ans)


for i in range(int(input())):
	m = list(map(int, input().split()))
	diff = abs(m[1] - m[0])
	ans = diff // 10
	if diff % 10 != 0:
		ans += 1
	print(ans)


testList = []
number = int(input())
for i in range(number):
	testList.append([int(num) for num in input().split()])
for i in testList:
	col = 0
	if i[0] > i[1]:
		raznitsa = i[0] - i[1]
	elif i[0] < i[1]:
		raznitsa = i[1] - i[0]
	else:
		print(col)
		continue
	col += raznitsa // 10
	raznitsa %= 10
	if raznitsa != 0:
		col += 1
	print(col)


num = int(input())
for i in range(num):
	(a, b) = input().strip().split()
	a = int(a)
	b = int(b)
	if a < b:
		temp = b - a
		if temp % 2 == 1:
			answer = 1
		elif temp % 2 == 0:
			answer = 2
	elif a > b:
		temp = a - b
		if temp % 2 == 1:
			answer = 2
		elif temp % 2 == 0:
			answer = 1
	else:
		answer = 0
	print(answer)


a = int(input())
for item in range(a):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	if a == b:
		print(0)
	elif abs(a - b) <= 10:
		print(1)
	elif abs(a - b) % 10 == 0:
		print(abs(a - b) // 10)
	else:
		print(abs(a - b) // 10 + 1)


def find(a, b):
	count = 0
	if a == b:
		return 0
	else:
		x = max(a, b)
		y = min(a, b)
		if (x - y) % 10 == 0:
			return (x - y) // 10
		else:
			return (x - y) // 10 + 1
n = int(input())
for i in range(0, n):
	(a, b) = map(int, input().split())
	print(find(a, b))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	l = abs(a - b)
	ans = 0
	if l == 0:
		print('0')
	elif l > 0 and l <= 10:
		print('1')
	else:
		ans += l // 10
		if l % 10 == 0:
			print(ans)
		else:
			ans += 1
			print(ans)


T = int(input())
for t in range(T):
	(a, b) = [int(x) for x in input().split()]
	(d, rem) = divmod(abs(a - b), 10)
	if rem > 0:
		print(d + 1)
	else:
		print(d)


import math
ct = input()
for line in range(int(ct)):
	line = [int(i) for i in input().split()]
	print(math.ceil(abs(line[0] - line[1]) / 10))


from sys import stdin, stdout
int_in = lambda : int(stdin.readline())
arr_in = lambda : [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for y in range(rows)]
str_in = lambda : stdin.readline().strip()
out = lambda o: stdout.write('{}\n'.format(o))
arr_out = lambda o: out(' '.join(map(str, o)))
bool_out = lambda o: out('YES' if o else 'NO')

def solve(a, b):
	if a == b:
		return 0
	elif a > b and (a - b) % 2 == 0:
		return 1
	elif a < b and (a - b) % 2 == 1:
		return 1
	return 2
for i in range(int_in()):
	(a, b) = arr_in()
	out(solve(a, b))


import os
from heapq import heapify, heappop, heappush
import sys
import math
import operator
import bisect
from collections import defaultdict
from io import BytesIO, IOBase
sys.setrecursionlimit(10 ** 5)

def inpt():
	return [int(k) for k in input().split()]

def main():
	for _ in range(int(input())):
		(a, b) = inpt()
		ans = 0
		dif = abs(a - b)
		for i in range(10, 0, -1):
			r = dif % i
			ans += dif // i
			dif = r
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin, stdout
from math import ceil, floor, factorial, gcd, log, pi
from collections import deque, defaultdict, OrderedDict, Counter
import random
import itertools
from heapq import heapify, heappush, heappop
integerMaxValue = float('inf')
integerMinValue = float('-inf')
MOD = 10 ** 9 + 7

def readInt():
	return int(stdin.readline())

def readInts():
	return map(int, stdin.readline().strip().split())

def readString():
	return stdin.readline()

def readStrings():
	return map(str, stdin.readline().strip().split())

def readIntArray():
	return list(map(int, stdin.readline().strip().split()))

def readStrArray():
	return list(map(str, stdin.readline().strip().split()))

def constructMinHeap(nums, n):
	minHeap = []
	for num in nums:
		heappush(minHeap, num)
	return minHeap

def constructMaxHeap(nums, n):
	maxHeap = []
	for num in nums:
		heappush(maxHeap, -num)
	return maxHeap

def solve(a, b):
	if a > b:
		temp = a - b
	else:
		temp = b - a
	return ceil(temp / 10)
testCases = readInt()
for case in range(testCases):
	(a, b) = readInts()
	print(solve(a, b))


import sys
import math
import itertools

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	(a, b) = get_ints()
	c = abs(a - b)
	if c % 10 == 0:
		print(c // 10)
	else:
		print(c // 10 + 1)


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


for t in range(int(input())):
	(n, m) = map(int, input().split())
	if n == m:
		print(0)
	else:
		x = abs(n - m)
		s = x // 10
		if x % 10 != 0:
			print(s + 1)
		else:
			print(s)


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	p = abs(n - m)
	if p % 10 == 0:
		print(p // 10)
	else:
		print(p // 10 + 1)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	ans = (abs(a - b) - 1) // 10 + 1
	print(ans)


import sys

def main():
	t = Iint()
	for _ in range(t):
		(a, b) = Imap()
		x = abs(a - b)
		print(x // 10 + bool(x % 10))
en = enumerate
FIO = 10
BUFSIZE = 8 * 1024

def Istr():
	return input()

def Iint():
	return int(input())

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

def Imap():
	return map(int, input().split())

def Plist(li, s=' '):
	print(s.join(map(str, li)))

def debug(*args, c=6):
	pass
	print('\x1b[3{}m'.format(c), *args, '\x1b[0m', file=sys.stderr)
if not FIO:
	if __name__ == '__main__':
		main()
		exit()
else:
	from io import BytesIO, IOBase
	import os

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


T = int(input())
list = []
for x in range(T):
	(a, b) = map(int, input().split())
	sub = a - b
	subb = b - a
	if a > b:
		if sub % 2 == 0:
			list.append(1)
		elif sub % 2 == 1:
			list.append(2)
	elif a < b:
		if subb % 2 == 0:
			list.append(2)
		elif subb % 2 == 1:
			list.append(1)
	elif a == b:
		list.append(0)
for x in list:
	print(x)


t = int(input())
while t > 0:
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	print(int(abs(k - n) / 10) + (abs(k - n) % 10 != 0))
	t -= 1


def main():
	t = int(input())
	for case in range(t):
		(a, b) = input().split()
		a = int(a)
		b = int(b)
		if a > b:
			(a, b) = swap(a, b)
		if a == b:
			print(0)
		else:
			count = 0
			count += (b - a) // 10
			rem = (b - a) % 10
			if rem > 0:
				count += 1
			print(count)

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)
main()


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


t = int(input())
lst = []
for i in range(t):
	(a, b) = map(int, input().split())
	lst.append([a, b])
for i in lst:
	x = abs(i[0] - i[1])
	print(int(x / 10)) if x % 10 == 0 else print(int(x // 10) + 1)


def solve(a, b):
	if a == b:
		return 0
	if a % 2 == b % 2 and a > b:
		return 1
	if a % 2 != b % 2 and a < b:
		return 1
	return 2
t = int(input())
for tt in range(t):
	(a, b) = list(map(int, input().split()))
	print(solve(a, b))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	f = (x + 9) // 10
	print(f)


t = int(input())
for i in range(t):
	count = 0
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	while diff > 0:
		if diff >= 10:
			count = count + int(diff / 10)
			diff = diff % 10
			if diff == 0:
				break
		elif diff >= 9:
			count = count + int(diff / 9)
			diff = diff % 9
			if diff == 0:
				break
		elif diff >= 8:
			count = count + int(diff / 8)
			diff = diff % 8
			if diff == 0:
				break
		elif diff >= 7:
			count = count + int(diff / 7)
			diff = diff % 7
			if diff == 0:
				break
		elif diff >= 6:
			count = count + int(diff / 6)
			diff = diff % 6
			if diff == 0:
				break
		elif diff >= 5:
			count = count + int(diff / 5)
			diff = diff % 5
			if diff == 0:
				break
		elif diff >= 4:
			count = count + int(diff / 4)
			diff = diff % 4
			if diff == 0:
				break
		elif diff >= 3:
			count = count + int(diff / 3)
			diff = diff % 3
			if diff == 0:
				break
		elif diff >= 2:
			count = count + int(diff / 2)
			diff = diff % 2
			if diff == 0:
				break
		else:
			count = count + 1
			break
	print(count)


n = int(input())
while n > 0:
	s = input().split()
	a = int(s[0])
	b = int(s[1])
	if a == b:
		print('0')
	elif a < b:
		if (b - a) % 2 == 0:
			print('2')
		else:
			print('1')
	elif (a - b) % 2 == 0:
		print('1')
	else:
		print('2')
	n -= 1


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


def oddeven(nums):
	if nums[0] < nums[1] and sum(nums) % 2 == 1 or (nums[0] > nums[1] and sum(nums) % 2 == 0):
		return 1
	elif nums[0] < nums[1] and sum(nums) % 2 == 0 or (nums[0] > nums[1] and sum(nums) % 2 == 1):
		return 2
	else:
		return 0
for i in range(int(input())):
	x = list(map(int, input().split()))
	print(oddeven(x))


t = int(input())
while t > 0:
	t -= 1
	ans = 0
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		diff = abs(a - b)
		ans += diff // 10
		rem = diff % 10
		if rem > 0:
			ans += 1
		print(ans)


from math import ceil
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	p = abs(x - y)
	ans = ceil(p / 10)
	print(int(ans))


def run():
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		return
	if a < b and b - a & 1 or (a > b and a - b & 1 ^ 1):
		print(1)
		return
	else:
		print(2)
		return
t = int(input())
for i in range(t):
	run()


def main():
	tmp = 0
	result_list = []
	n = int(input())
	for i in range(n):
		(a, b) = map(int, input().split())
		counter = 0
		flag = True
		c = a - b
		if c == 0:
			result_list.append(0)
			flag = False
		if a < b:
			tmp = a
			a = b
			b = tmp
		if a > b:
			while flag:
				if a - 10000000 > b:
					a -= 10000000
					counter += 1000000
				if a - 1000000 > b:
					a -= 1000000
					counter += 100000
				if a - 100000 > b:
					a -= 100000
					counter += 10000
				if a - 10000 > b:
					a -= 10000
					counter += 1000
				if a - 1000 > b:
					a -= 1000
					counter += 100
				if a - 100 > b:
					a -= 100
					counter += 10
				a -= 10
				counter += 1
				if a <= b:
					flag = False
					result_list.append(counter)
	for item in result_list:
		print(item)
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = min(a, b)
	d = max(a, b)
	cd = abs(c - d)
	if cd / 10 == cd // 10:
		print(cd // 10)
	else:
		print(cd // 10 + 1)


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd
from collections import deque
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	t = abs(a - b)
	x = ceil(t / 10)
	print(x)


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


for i in range(int(input())):
	(a, b) = map(int, input().split())
	xx = max(a, b) - min(a, b)
	cnt = xx // 10
	if xx % 10 != 0:
		cnt += 1
	print(cnt)


import math
for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = math.fabs(b - a)
	ans = math.ceil(c / 10)
	print(ans)


from sys import stdin
T = int(stdin.readline())
while T:
	T = T - 1
	(a, b) = map(int, stdin.readline().split())
	R = b - a
	if R < 0:
		if R % 2 == 0:
			print(1)
		else:
			print(2)
	elif R > 0:
		if R % 2 == 0:
			print(2)
		else:
			print(1)
	else:
		print(0)


cases = int(input())
for i in range(cases):
	(a, b) = map(int, input().split())
	num = abs(b - a) // 10
	rem = abs(b - a) % 10
	if rem == 0:
		print(num)
	else:
		print(num + 1)


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)
		elif a % 2 == b % 2:
			print(1)
		else:
			print(2)
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	print(x // 10 + bool(x % 10))


import math
t = int(input())
for i in range(t):
	d = input().split()
	a = int(d[0])
	b = int(d[1])
	if a == b:
		print(0)
	elif a > b:
		if (a - b) % 2 == 0:
			print(1)
		else:
			print(2)
	elif (b - a) % 2 == 1:
		print(1)
	else:
		print(2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	ans = diff // 10 + (diff % 10 != 0)
	print(ans)


for i in range(int(input())):
	(a, b) = [int(s) for s in input().split()]
	print((abs(a - b) - 1) // 10 + 1)


T = int(input())
for case in range(T):
	(a, b) = map(int, input().split())
	ans = (abs(a - b) + 9) // 10
	print(ans)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	k = max(x, y) - min(x, y)
	b = k // 10
	a = k % 10
	if a == 0:
		print(b)
	else:
		print(1 + b)


p = int(input())
while p:
	(m, n) = [int(i) for i in input().split(' ')]
	if m > n:
		c = (m - n) // 10
		if (m - n) % 10 != 0:
			c = c + 1
		print(c)
	elif m < n:
		c = (n - m) // 10
		if (n - m) % 10 != 0:
			c = c + 1
		print(c)
	else:
		print('0')
	p = p - 1


from sys import stdin, stdout
ans = ''
for _ in ' ' * int(stdin.readline()):
	(a, b) = map(int, stdin.readline().split())
	k = abs(a - b)
	ans += str(k // 10 + (k % 10 != 0)) + ' '
stdout.write(ans)


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


n = int(input())
for x in range(n):
	numeros = input().split()
	distancia = int(numeros[1]) - int(numeros[0])
	if distancia % 2 == 1 and distancia > 0:
		print(1)
	elif distancia % 2 == 0 and distancia < 0:
		print(1)
	elif distancia == 0:
		print(0)
	else:
		print(2)


t = int(input())
result = []
for i in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		result.append(0)
	else:
		d = 0
		move = 0
		difference = abs(a - b)
		differenceString = str(difference)
		while len(differenceString) != 1:
			newDifference = differenceString[0] + '0' * (len(differenceString) - 1)
			newIntDifference = int(newDifference)
			d = newIntDifference / 10
			move += d
			difference -= newIntDifference
			differenceString = str(difference)
		if differenceString != '0':
			move += 1
			result.append(int(move))
		else:
			result.append(int(move))
for j in range(len(result)):
	print(result[j], end='\n')


t = int(input())
while t > 0:
	t -= 1
	line = input().split(' ')
	a = int(line[0])
	b = int(line[1])
	if a == b:
		print(0)
		continue
	diff = abs(a - b)
	if diff <= 10:
		print(1)
		continue
	if diff % 10 == 0:
		count = diff / 10
	else:
		count = diff / 10 + 1
	print(int(count))


def solve(a, b):
	s = 0
	n = abs(a - b)
	for i in range(10, 0, -1):
		s += n // i
		n = n % i
	return s
t = int(input())
for i in range(0, t):
	(a, b) = input().split()
	print(solve(int(a), int(b)))


x = int(input())
for i in range(x):
	(a, b) = map(int, input().split())
	s = 0
	z = abs(a - b)
	while z != 0:
		for i in range(10, 0, -1):
			s += z // i
			z -= z // i * i
	print(s)


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


from sys import stdin, stdout
t = int(stdin.readline())
for i in range(t):
	odds = []
	evens = []
	(a, b) = map(int, stdin.readline().split())
	temp = abs(b - a)
	oparations = 0
	if a != b:
		if temp % 2 == 0:
			if b - a < 0:
				a -= abs(b - a)
				oparations += 1
			else:
				a += b - a - 1 + 1
				oparations += 2
		elif b - a < 0:
			a -= abs(b - a) + 1 + 1
			oparations += 2
		else:
			a += abs(b - a)
			oparations += 1
	stdout.write(str(oparations))
	print()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	t = abs(a - b)
	p = t // 10
	q = t % 10
	if q:
		p += 1
	print(p)


import math

def rints():
	return list(map(int, input().split()))
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 == 0:
			print(1)
		else:
			print(2)
	else:
		print(1 + (not (b - a) % 2))


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


n = int(input())
k = 0
s = []
for i in range(n):
	s.append(list(map(int, input().split())))
while k < n:
	count = 0
	if s[k][0] == s[k][1]:
		pass
	elif s[k][0] > s[k][1]:
		diff = s[k][0] - s[k][1]
		count += 1
		if diff % 2 != 0:
			count += 1
	elif s[k][0] < s[k][1]:
		diff = s[k][1] - s[k][0]
		count += 1
		if diff % 2 != 1:
			count += 1
	print(count)
	count = 0
	k += 1


from sys import stdin, stdout

def INPUT():
	return list((int(i) for i in stdin.readline().split()))

def inp():
	return stdin.readline()

def out(x):
	return stdout.write(x)
import math
import random
for _ in range(int(input())):
	(a, b) = INPUT()
	print(int(math.ceil(abs(a - b) / 10)))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	res = diff // 10
	if diff % 10 > 0:
		res += 1
	print(res)


t = int(input())
k = 0
j = 0
for i in range(t):
	c = 0
	(m, n) = [int(elem) for elem in input().split()]
	while n != m:
		d = n - m
		if d > 0:
			if d % 2 == 0:
				k = d - 1
			else:
				k = d
			m += k
			c += 1
		else:
			if d % 2 != 0:
				j = d - 1
			else:
				j = d
			m += j
			c += 1
	print(c)


import sys
import math
mod = 998244353
cases = True
dynamic_factorial = False

def main(test_case=False):
	n = int(input()) if test_case else 1
	for _ in range(n):
		test()

def fast_pow(a: int, b: int):
	res = 1
	while b > 0:
		if b & 1:
			res *= a
		a *= a
		b >>= 1
	return res

def c2(n):
	return n * (n - 1) // 2

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

def bits(n: int):
	return list(bin(n)).count('1')

def flush():
	sys.stdout.flush()

def parr(arr):
	print(*arr, sep=' ')

def gcd(a, b):
	while b:
		if b % a == 0:
			break
		tmp = a
		a = b % a
		b = tmp
	return a

def ext_gcd(a: int, b: int):
	if b == 0:
		return [a, [1, 0]]
	res = ext_gcd(b, a % b)
	g = res[0]
	if g != 1:
		return False
	x1 = res[1][0]
	y1 = res[1][1]
	x = y1
	y = x1 - y1 * (a // b)
	return [g, [x, y]]

def get_set(a):
	res = {}
	for x in a:
		if x in res:
			res[x] += 1
		else:
			res[x] = 1
	return res
fact = {0: 1}

def factorial(n):
	if dynamic_factorial:
		if n not in fact:
			fact[n] = factorial(n - 1) * n
		return fact[n]
	else:
		res = 1
		while n > 0:
			res = res * n % mod
			n -= 1
		return res

def sum_of(a):
	res = 0
	for x in a:
		res = (res + x) % mod
	return res

def prod_of(a):
	res = 1
	for x in a:
		res = res * x % mod
	return res

def test():
	(a, b) = get()
	print((max(a - b, b - a) + 9) // 10)
main(cases)


for x in range(int(input())):
	(val1, val2) = map(int, input().split())
	print(int(abs(val1 - val2) / 10) + min(1, abs(val1 - val2) % 10))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	s = abs(b - a) // 10
	if abs(b - a) % 10 != 0:
		s += 1
	print(s)


for i in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	apar = a % 2
	bpar = b % 2
	if a == b:
		print(0)
	elif apar == bpar:
		print(1 if a > b else 2)
	else:
		print(1 if a < b else 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()


from math import ceil
for _ in [*open(0)][1:]:
	(a, b) = map(int, _.split())
	print(ceil(abs(a - b) / 10))


def game():
	a = input()
	lists = []
	output_list = []
	for i in range(int(a)):
		a = input()
		l = [int(i) for i in a.split(' ')]
		lists.append(l)
	for i in lists:
		(a, b) = i
		dif = abs(b - a)
		tens = dif // 10
		if dif % 10:
			tens += 1
		output_list.append(str(tens))
	return '\n'.join(output_list)
print(game())


def main():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		d = abs(b - a)
		(q, r) = (d // 10, d % 10)
		print(q + (1 if r > 0 else 0))
main()


t = int(input())
for i in range(t):
	arr = input().split()
	a = int(arr[0])
	b = int(arr[1])
	if b < a:
		(a, b) = (b, a)
	ele = b - a
	ans = 0
	extra = ele % 10
	if extra != 0:
		ans += 1
	print(ans + ele // 10)


from math import ceil

def main():
	for i in range(int(input())):
		(a, b) = map(int, input().split())
		print(ceil((max(a, b) - min(a, b)) / 10))
main()


n = int(input())
for _ in range(n):
	args = input().split(' ')
	for i in range(0, len(args)):
		args[i] = int(args[i])
	if args[0] == args[1]:
		print('0')
	elif args[0] < args[1]:
		if (args[0] % 2 == 0) == (args[1] % 2 == 0):
			print('2')
		else:
			print('1')
	elif args[0] > args[1]:
		if (args[0] % 2 == 0) != (args[1] % 2 == 0):
			print('2')
		else:
			print('1')


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	k = abs(a - b)
	c = k % 10
	d = k // 10
	if c > 0:
		print(1 + d)
	else:
		print(d)


for _ in range(int(input())):
	(a, b) = (int(x) for x in input().split())
	if abs(a - b) % 10 == 0:
		print(abs(a - b) // 10)
	else:
		print(abs(a - b) // 10 + 1)


no_tests = int(input())
ans = []
while no_tests > 0:
	nums = list(map(int, input().split()))
	original = int(nums[0])
	target = int(nums[1])
	moves = 0
	if original == target:
		moves = 0
	elif original < target:
		if original % 2 == 1 and target % 2 == 1:
			moves = 2
		elif original % 2 == 1 and target % 2 == 0 or (original % 2 == 0 and target % 2 == 1):
			moves = 1
		elif original % 2 == 0 and target % 2 == 0:
			moves = 2
	elif original > target:
		if original % 2 == 1 and target % 2 == 1:
			moves = 1
		elif original % 2 == 1 and target % 2 == 0 or (original % 2 == 0 and target % 2 == 1):
			moves = 2
		elif original % 2 == 0 and target % 2 == 0:
			moves = 1
	ans.append(moves)
	no_tests -= 1
for i in range(len(ans)):
	if i == len(ans) - 1:
		print(ans[i], end='')
	else:
		print(ans[i])


testcases = int(input())
for j in range(testcases):
	values = list(map(int, input().split()))
	a = values[0]
	b = values[1]
	if a == b:
		print(0)
	elif a < b:
		if (b - a) % 2 == 0:
			print(2)
		elif (b - a) % 2 == 1:
			print(1)
	elif a > b:
		if (a - b) % 2 == 0:
			print(1)
		elif (a - b) % 2 == 1:
			print(2)


kolichestvo = int(input())
for i in range(kolichestvo):
	(a, b) = map(int, input().split())
	z = a - b
	if a == b:
		print('0')
		continue
	if a > b and z % 2 == 0:
		print('1')
		continue
	if a > b and z % 2 != 0:
		print('2')
	if a < b and b - a == 1:
		print('1')
		continue
	if a < b and (b - a) % 2 != 0:
		print('1')
		continue
	if a < b and (b - a) % 2 == 0:
		print('2')


import math

def schet():
	string = input()
	(a, b) = list(map(int, string.split()))
	razn = a - b
	if razn == 0:
		print(0)
	else:
		razn = math.fabs(razn)
		if razn % 10 == 0:
			k = razn // 10
		else:
			k = razn // 10 + 1
		print(int(k))
t = int(input())
for i in range(t):
	schet()


lis = []
for i in range(int(input())):
	l = input().split()
	a = int(l[0])
	b = int(l[1])
	g = a - b
	l = b - a
	if a == b:
		lis.append(0)
	elif a > b and (a - b) % 2 == 0:
		lis.append(1)
	elif a < b and (b - a) % 2 == 1:
		lis.append(1)
	else:
		lis.append(2)
for x in lis:
	print(x)


t = int(input())
for test in range(t):
	(a, b) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	if a == b:
		print(0)
		continue
	print((a - b) // 10 + bool(a - ((a - b) // 10 * 10 + b)))


testCases = int(input(''))
for i in range(0, testCases):
	user = input('')
	data = user.split(' ')
	a = int(data[0])
	b = int(data[1])
	diff = abs(a - b)
	minSteps = int(diff / 10)
	if diff % 10 != 0:
		minSteps = minSteps + 1
	print(minSteps)


import sys
from functools import reduce
from collections import Counter
import time
import datetime
from math import sqrt, gcd

def ip():
	return int(sys.stdin.readline())

def sip():
	return sys.stdin.readline()

def mip():
	return map(int, sys.stdin.readline().split())

def mips():
	return map(str, sys.stdin.readline().split())

def lip():
	return list(map(int, sys.stdin.readline().split()))

def matip(n, m):
	lst = []
	for i in range(n):
		arr = lip()
		lst.append(arr)
	return lst

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def minJumps(arr, n):
	jumps = [0 for i in range(n)]
	if n == 0 or arr[0] == 0:
		return float('inf')
	jumps[0] = 0
	for i in range(1, n):
		jumps[i] = float('inf')
		for j in range(i):
			if i <= j + arr[j] and jumps[j] != float('inf'):
				jumps[i] = min(jumps[i], jumps[j] + 1)
				break
	return jumps[n - 1]

def dic(arr):
	return Counter(arr)

def check_prime(n):
	if n < 2:
		return False
	for i in range(2, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			return False
	return True
n = ip()
while n:
	n -= 1
	(a, b) = mip()
	c = b - a
	ans = c // 10
	ans = abs(ans)
	if ans * 10 < c:
		ans += 1
	print(ans)


t = int(input().strip())
s = []
for i in range(t):
	g = input().strip()
	s.append([])
	s[i] = g.split(' ')
	s[i] = list(map(int, s[i]))

def mail(t):
	for i in range(t):
		print(x_and_y(t, s[i][0], s[i][1]))

def x_and_y(t, a, b):
	if a == b:
		return 0
	if a > b:
		if (a - b) % 2 == 0:
			return 1
		else:
			return 2
	if a < b:
		if (b - a) % 2 == 1:
			return 1
		else:
			return 2
mail(t)


import math
Q = int(input())
for i in range(Q):
	(a, b) = map(int, input().split())
	I = b - a
	if I < 0 and I % 10 != 0:
		print(abs(math.ceil((b - a) / 10)) + 1)
	else:
		print(abs(math.ceil((b - a) / 10)))


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	count = 0
	if a == b:
		print('0')
	elif a < b:
		count += (b - a) // 10
		if (b - a) % 10 != 0:
			count += 1
		print(count)
	elif a > b:
		count += (a - b) // 10
		if (a - b) % 10 != 0:
			count += 1
		print(count)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	print(int((b - a) / 10) + (1 if (b - a) % 10 else 0))


t = int(input())
for qweqe in range(t):
	(a, b) = 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 a < b:
		print(2)
	elif a % 2 != b % 2 and a > b:
		print(2)
	elif a % 2 != b % 2 and a < b:
		print(1)
	else:
		print(-1)


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


t = int(input())
for _ in range(t):
	vet = list(map(int, input().split()))
	x = vet[0]
	y = vet[1]
	d = x - y
	if x == y:
		print(0)
	elif d % 2 == 1:
		print(1 if x - y < 0 else 2)
	elif d % 2 == 0:
		print(1 if x - y > 0 else 2)


def solve(a, b, count):
	if a > b:
		diff = a - b
	if a < b:
		diff = b - a
	if a == b:
		return count
	while diff != 0:
		while diff >= 10:
			count += diff // 10
			diff -= diff // 10 * 10
		while diff >= 9:
			diff -= 9
			count += 1
		while diff >= 8:
			diff -= 8
			count += 1
		while diff >= 7:
			diff -= 7
			count += 1
		while diff >= 6:
			diff -= 6
			count += 1
		while diff >= 5:
			diff -= 5
			count += 1
		while diff >= 4:
			diff -= 4
			count += 1
		while diff >= 3:
			diff -= 3
			count += 1
		while diff >= 2:
			diff -= 2
			count += 1
		while diff >= 1:
			diff -= 1
			count += 1
	return count
f = int(input())
for x in range(f):
	count = 0
	(a, b) = list(map(int, input().split()))
	print(solve(a, b, count))


import math
t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	ans = math.ceil(abs(b - a) / 10)
	print(ans)


t = int(input())
while t:
	t -= 1
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	res = abs(a - b) // 10
	if abs(a - b) % 10 != 0:
		res += 1
	print(res)


t = int(input())
res = [0] * t
for k in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	delta = abs(b - a)
	res[k] = delta // 10
	if res[k] * 10 < delta:
		res[k] += 1
for k in range(t):
	print(res[k])


import os
import sys
from io import BytesIO, IOBase
import math as M
import itertools as ITR
from collections import defaultdict as D
from collections import Counter as C
from collections import deque as Q
import threading
from functools import lru_cache, reduce
from functools import cmp_to_key as CMP
from bisect import bisect_left as BL
from bisect import bisect_right as BR
import random as R
import string
import cmath, time
enum = enumerate
start_time = time.time()
MOD = 1000000007
MA = float('inf')
MI = float('-inf')
di8 = [(1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)]
di4 = [(1, 0), (0, 1), (-1, 0), (0, -1)]

def increase_stack():
	sys.setrecursionlimit(2 ** 32 // 2 - 1)
	threading.stack_size(1 << 27)
	t = threading.Thread(target=main)
	t.start()
	t.join()

def prints(a):
	print(a, end=' ')

def binary(n):
	return bin(n)[2:]

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def maxfactor(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
	if q:
		return q[-1]

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(M.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	l.sort()
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def seive(n):
	a = [1]
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p ** 2, n + 1, p):
				prime[i] = False
		p = p + 1
	for p in range(2, n + 1):
		if prime[p]:
			a.append(p)
	return a

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(M.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countchar(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def str_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q

def lis(arr):
	n = len(arr)
	lis = [1] * n
	maximum = 0
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
				maximum = max(maximum, lis[i])
	return maximum

def lcm(arr):
	a = arr[0]
	val = arr[0]
	for i in range(1, len(arr)):
		gcd = gcd(a, arr[i])
		a = arr[i]
		val *= arr[i]
	return val // gcd

def ncr(n, r):
	return M.factorial(n) // (M.factorial(n - r) * M.factorial(r))

def npr(n, r):
	return M.factorial(n) // M.factorial(n - r)

def inint():
	return int(inp())

def inarr():
	return list(map(int, inp().split()))

def invar():
	return map(int, inp().split())

def instr():
	s = inp()
	return list(s)

def insarr():
	return inp().split()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
inp = lambda : sys.stdin.readline().rstrip('\r\n')
TestCases = 1

def solve():
	(a, b) = invar()
	c = abs(a - b)
	print(M.ceil(c / 10))

def main():
	flag = 0
	try:
		sys.stdin = open('c:/Users/Manoj Chowdary/Documents/python/CodeForces/contest-div-2/input.txt', 'r')
		sys.stdout = open('c:/Users/Manoj Chowdary/Documents/python/CodeForces/contest-div-2/output.txt', 'w')
	except:
		flag = 1
	t = 1
	if TestCases:
		t = inint()
	for _ in range(1, t + 1):
		solve()
	if not flag:
		print('Time: %.4f sec' % (time.time() - start_time))
		localtime = time.asctime(time.localtime(time.time()))
		print(localtime)
		sys.stdout.close()
main()


import sys
input = sys.stdin.readline
import heapq
import copy
import math
import decimal

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def insr2():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
ans = 0

def pr_list(a):
	print(*a, sep=' ')

def main():
	tests = inp()
	mod = 1000000007
	limit = 10 ** 18
	ans = 0
	stack = []
	hashm = {}
	arr = []
	heapq.heapify(arr)
	for test in range(tests):
		[a, b] = inlt()
		diff = abs(b - a)
		ans = math.ceil(diff / 10)
		print(ans)
main()


import math
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a % 10 == b % 10:
		print((max(a, b) - min(a, b)) // 10)
	else:
		print((max(a, b) - min(a, b)) // 10 + 1)


import math
t = int(input())
for case in range(t):
	(a, b) = [int(s) for s in input().split(' ')]
	answer = math.ceil(abs(b - a) / 10)
	print(answer)


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math

def bin1(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = k ** mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin1(mid + 1, r, k, t, b, val, ans)
		else:
			return bin1(l, mid - 1, k, t, b, val, ans)

def bin2(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = t * k ** mid + b * mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin2(l, mid - 1, k, t, b, val, ans)
		else:
			return bin2(mid + 1, r, k, t, b, val, ans)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	l = []
	for i in range(2, n + 1):
		if prime[i]:
			l.append(i)
	return l

def bin(l, r, ll, val):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if val >= ll[mid][0] and val <= ll[mid][1]:
			return mid
		elif val < ll[mid][0]:
			return bin(l, mid - 1, ll, val)
		else:
			return bin(mid + 1, r, ll, val)

def deci(n):
	s = ''
	while n != 0:
		if n % 2 == 0:
			n = n // 2
			s = '0' + s
		else:
			n = n // 2
			s = '1' + s
	return s

def diff(s1, s2):
	if len(s1) < len(s2):
		v = len(s1)
		while v != len(s2):
			s1 = '0' + s1
			v = v + 1
	else:
		v = len(s2)
		while v != len(s1):
			s2 = '0' + s2
			v = v + 1
	c = 0
	for i in range(len(s1)):
		if s1[i:i + 1] != s2[i:i + 1]:
			c = c + 1
	return c
from sys import stdin, stdout

def fac(a, b):
	v = a
	while a != b:
		v *= a - 1
		a = a - 1
	return v

def bino(l, r, n):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		val1 = math.log(n / mid + 1, 2)
		val2 = int(val1)
		if val1 == val2:
			return val1
		elif val1 < 1.0:
			return bino(l, mid - 1, n)
		else:
			return bino(mid + 1, r, n)

def binary(l, r, ll, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		if ll[mid] <= val:
			ans = mid
			return binary(mid + 1, r, ll, val, ans)
		else:
			return binary(l, mid - 1, ll, val, ans)
t = int(stdin.readline())
for i in range(t):
	(a, b) = map(int, stdin.readline().split(' '))
	c = 0
	if a == b:
		print(0)
	elif a > b:
		val = a - b
		if val % 2 == 0:
			print(1)
		else:
			print(2)
	else:
		val = b - a
		if val % 2 == 0:
			print(2)
		else:
			print(1)


import math
n = int(input())
a = list()
b = list()
answ = list()
m = 0
k = 0
for i in range(n):
	q = list(map(int, input().split(' ')))
	a.append(q[0])
	b.append(q[1])
for i in range(n):
	m = abs(a[i] - b[i])
	k = 0
	for j in range(10, 0, -1):
		k += m // j
		m -= m // j * j
	print(k)


m = int(input())
l = [list(map(int, input().split())) for i in range(m)]
for i in l:
	a = i[0]
	b = i[1]
	x = abs(a - b) / 10
	if x == int(x):
		print(int(x))
	else:
		print(int(x) + 1)


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 i in range(t):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	print(int((d + 9) / 10))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif b > a:
		rem = int((b - a) % 10)
		print((b - a) // 10 + (1 if rem != 0 else 0))
	else:
		rem = int((a - b) % 10)
		print((a - b) // 10 + (1 if rem != 0 else 0))


n = int(input())
for i in range(n):
	(a, b) = list(map(int, input().split()))
	s = abs(a - b)
	s1 = s // 10
	s2 = s % 10
	if s2 > 0:
		s1 += 1
	print(s1)


import math
t = int(input())
while t != 0:
	(a, b) = map(int, input().split())
	if a == b:
		print('0')
	elif a > b:
		a -= b
		print(math.ceil(a / 10))
	else:
		b -= a
		print(math.ceil(b / 10))
	t -= 1


import sys
from typing import List, Union

def rl(int_: bool=True, is_split: bool=True) -> Union[List[str], List[int]]:
	if int_:
		return [int(w) for w in sys.stdin.readline().split()]
	if is_split:
		return [w for w in sys.stdin.readline().split()]
	return sys.stdin.readline().strip()

def ops(x: int):
	m = 0
	while x:
		for i in range(10, 0, -1):
			m += x // i
			x = x % i
	return m
for _ in range(rl()[0]):
	(a, b) = rl()
	print(ops(abs(a - b)))


n = int(input())
for i in range(n):
	(a, b) = [int(j) for j in input().split()]
	(a, b) = sorted([a, b])
	if (b - a) % 10 == 0:
		print((b - a) // 10)
	else:
		print((b - a) // 10 + 1)


for i in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	if a % 10 == b % 10:
		print(abs(a - b) // 10)
	else:
		print(abs(a - b) // 10 + 1)


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


i = int(input())
for _ in range(i):
	(a, b) = map(int, input().split())
	if a > b:
		tmp = a
		a = b
		b = tmp
	tot = (b - a) // 10
	if (b - a) % 10 != 0:
		tot += 1
	print(tot)


from sys import stdin
_input = stdin.readline
(_range, _int, _abs) = (range, int, abs)

def solution():
	for _ in _range(_int(_input())):
		(a, b) = [_int(i) for i in _input().split()]
		d = _abs(b - a)
		print(d // 10 if d % 10 == 0 else d // 10 + 1)
solution()


n = int(input())
array_1 = []
array_2 = []
for i in range(0, n):
	numbers = input().split()
	array_1 += [int(numbers[0])]
	array_2 += [int(numbers[1])]
for i in range(0, n):
	k = abs(array_1[i] - array_2[i]) // 10
	if abs(array_1[i] - array_2[i]) % 10 != 0:
		k += 1
	print(k)


t = input()
for i in range(int(t)):
	line = input()
	line = line.split()
	a = line[0]
	b = line[1]
	diff = abs(int(a) - int(b))
	num = int(diff / 10)
	if not diff % 10 == 0:
		num = num + 1
	print(num)


t = int(input())
for i in range(t):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	if a == b:
		c = 0
	elif (a - b) % 10 == 0:
		c = abs(a - b) // 10
	else:
		c = abs(a - b) // 10 + 1
	print(c)


test = int(input())
for t in range(test):
	(a, b) = map(int, input().split())
	minMove = 0
	differnce = 0
	if a != b:
		if a > b:
			c = a
			a = b
			b = c
		differnce = b - a
		while a != b:
			if differnce >= 10:
				steps = int((b - a) / 10)
				a += 10 * steps
				minMove += steps
				differnce = b - a
			else:
				a += differnce
				minMove += 1
	else:
		minMove = 0
	print(minMove)


import math
import operator

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


t = int(input())
counter = 0
for l in range(t):
	(x, y) = input().split()
	a = int(x)
	b = int(y)
	counter = 0
	even_difference = abs(b - a) % 2 == 0
	odd_difference = abs(b - a) % 2 != 0
	if b == a:
		counter = 0
	elif odd_difference and b > a or (even_difference and b < a):
		counter += 1
	elif even_difference and b > a or (odd_difference and b < a):
		counter += 2
	print(counter)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	if diff == 0:
		print(diff)
	else:
		c = diff // 10
		d = diff % 10
		if d != 0:
			e = 1
		else:
			e = 0
		move = abs(c + e)
		print(move)


for i in range(int(input())):
	(a, b) = input().split()
	dif = str(abs(int(a) - int(b)))
	if dif == '0':
		print(0)
	elif len(dif) == 1:
		print(1)
	elif dif[-1] == '0':
		print(dif[:-1])
	else:
		print(int(dif[:-1]) + 1)


t = int(input())
for i in range(t):
	(a, b) = [int(x) for x in input().split()]
	moves = 0
	while a != b:
		difference = abs(a - b)
		if a < b:
			if difference % 2 == 1:
				a += difference
			else:
				a += 1
		elif a > b:
			if difference % 2 == 0:
				a -= difference
			else:
				a -= difference + 1
		moves += 1
	print(moves)


n = int(input())
for i in range(n):
	l = input().split()
	a = abs(int(l[0]) - int(l[1]))
	if a % 10 == 0:
		print(a // 10)
	if a % 10 != 0:
		print(a // 10 + 1)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for i in range(t):
	(a, b) = invr()
	if a == b:
		print(0)
	elif a > b:
		m = a - b
		if m % 2 == 0:
			print(1)
		else:
			print(2)
	elif a < b:
		m = b - a
		if m % 2 != 0:
			print(1)
		else:
			print(2)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	(m, n) = invr()
	k = abs(m - n)
	(k1, k2) = (k // 10, k % 10)
	if k2:
		k1 += 1
	print(k1)


def solve(A, B):
	diff = A - B
	if diff == 0:
		print(0)
	elif diff < 0:
		if abs(diff) % 2 == 0:
			print(2)
		else:
			print(1)
	elif abs(diff) % 2 == 0:
		print(1)
	else:
		print(2)
t = int(input())
while t != 0:
	(a, b) = map(int, input().split(' '))
	solve(a, b)
	t -= 1


t = int(input())
while t:
	(a, b) = map(int, input().split())
	x = abs(b - a)
	ans = x // 10
	if x % 10:
		ans = ans + 1
	print(ans)
	t = t - 1


import sys
input = sys.stdin.buffer.readline

def solution():
	(a, b) = map(int, input().split())
	x = abs(a - b)
	ans = 0
	ans += x // 10
	if x % 10:
		ans += 1
	print(ans)
t = int(input())
for _ in range(t):
	solution()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	(c, d) = divmod(diff, 10)
	res = 0
	res += c
	res += 0 if d == 0 else 1
	print(res)


n = int(input())
for _ in range(n):
	(x, y) = map(int, input().split())
	c = abs(x - y)
	if c % 10 == 0:
		print(c // 10)
	else:
		print(c // 10 + 1)


import math
T = int(input())
for t in range(T):
	(a, b) = [int(i) for i in input().split(' ')]
	diff = abs(a - b)
	print(math.ceil(diff / 10))


import math
t = int(input())
for i in range(t):
	s = input().split()
	a = int(s[0])
	b = int(s[1])
	print(math.ceil(abs(a - b) / 10))


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


from sys import stdin
import math
for _ in range(int(stdin.readline())):
	(a, b) = list(map(int, stdin.readline().split()))
	res = math.ceil(abs(a - b) / 10)
	print(res)


def find(a, b):
	if a == b:
		return 0
	elif b > a:
		diff = b - a
		quo = diff // 10
		if quo * 10 == diff:
			return quo
		return quo + 1
	else:
		diff = a - b
		quo = diff // 10
		if quo * 10 == diff:
			return quo
		return quo + 1
t = int(input())
while t > 0:
	(a, b) = [int(ele) for ele in input().split()]
	print(find(a, b))
	t = t - 1


t = int(input())
while t > 0:
	t -= 1
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	b = b - a
	c = 0
	if b == 0:
		print(0)
		continue
	else:
		k = 10
		while b > 0:
			c += b // k
			b = b % k
			k -= 1
		print(c)


from sys import stdin, stdout
input = stdin.readline
print = lambda x: stdout.write(str(x) + '\n')
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	t = abs(a - b)
	ans = t // 10 + (1 if t - t // 10 * 10 else 0)
	print(ans)


import math
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	count = 0
	diff = abs(a - b)
	print(math.ceil(diff / 10))


t = int(input())
K = []
for i in range(t):
	(a, b) = list(map(int, input().split()))
	k = x = y = 0
	if a != b:
		if a > b:
			if (a - b) % 2 == 1:
				y = a - b + 1
			else:
				y = a - b
			x = 1
			while a != b:
				if a > b:
					a -= y
				else:
					a += x
				k += 1
		else:
			if (b - a) % 2 == 1:
				x = b - a
			else:
				x = b - a - 1
			while a != b:
				if b - a != 1:
					a += x
				else:
					a += 1
				k += 1
	K.append(k)
for i in range(t):
	print(K[i])


z = int(input())
for i in range(z):
	lst = list(input().split())
	(lst[0], lst[1]) = (int(lst[0]), int(lst[1]))
	lst.sort()
	y = int((lst[1] - lst[0]) / 10)
	if (lst[1] - lst[0]) % 10 != 0:
		y += 1
	print(y)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	s = abs(a - b)
	if s == 0:
		print('0')
	else:
		print((s + 9) // 10)


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [input() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [int(input()) for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

class PriorityQueue:

	def __init__(self, l=[]):
		self.q = l
		heapq.heapify(self.q)
		return

	def push(self, n):
		heapq.heappush(self.q, n)
		return

	def pop(self):
		return heapq.heappop(self.q)

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def main():
	T = Scanner.int()
	for _ in range(T):
		(a, b) = Scanner.map_int()
		if a == b:
			print(0)
			continue
		if a < b:
			if a % 2 == b % 2:
				print(2)
			else:
				print(1)
		elif a % 2 == b % 2:
			print(1)
		else:
			print(2)
main()


def main():
	t = int(input())
	for _ in range(t):
		(a, b) = list(map(int, input().split()))
		p = abs(a - b) // 10 if abs(a - b) % 10 == 0 else abs(a - b) // 10 + 1
		print(p)
main()


n = int(input())
l = []
for i in range(n):
	(a, b) = [int(c) for c in input().split()]
	l.append((a, b))
for i in range(len(l)):
	(a, b) = l[i]
	if a == b:
		print(0)
		continue
	print(abs(a - b) // 10 + 1 if abs(a - b) % 10 != 0 else abs(a - b) // 10)


import math
n = int(input())
for t in range(n):
	a = list(map(int, input().split()))
	if a[0] == a[1]:
		print(0)
	elif a[0] <= a[1]:
		aux = abs(a[0] - a[1])
		if aux % 2 == 0:
			print(2)
		else:
			print(1)
	else:
		aux = abs(a[0] - a[1])
		if aux % 2 == 0:
			print(1)
		else:
			print(2)


T = int(input())
for i in range(T):
	(A, B) = list(map(int, input().split()))
	K = A - B
	if K < 0:
		K = K * -1
	Answer = K // 10
	if K % 10 == 0:
		print(Answer)
	else:
		print(Answer + 1)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	x = 1 if diff % 10 != 0 else 0
	print(diff // 10 + x)


import math
t = int(input())
moves = []
for tt in range(t):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	if a == b:
		moves.append(0)
		continue
	elif a < b:
		moves.append(math.ceil((b - a) / 10))
		continue
	else:
		moves.append(math.ceil((a - b) / 10))
		continue
for i in moves:
	print(i)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = abs(b - a) // 10 + min(1, abs(b - a) % 10)
	print(x)


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

def main():
	t = int(input())
	for _ in range(t):
		print(solve())
main()


import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
INF = 1 << 60
MOD = 10 ** 9 + 7
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		if (a - b) % 2 == 0:
			print(1)
		else:
			print(2)
	elif a == b:
		print(0)
	elif (b - a) % 2 == 0:
		print(2)
	else:
		print(1)


from math import ceil
k = range(1, 11)
for t in range(int(input())):
	(a, b) = map(int, input().split())
	print(ceil(abs(a - b) / 10))


import sys
sysinput = sys.stdin.readline
import time
start_time = time.time()

def inp():
	return int(sysinput())

def inlt():
	return list(map(int, sysinput().split()))

def insr():
	s = sysinput()
	return list(s[:len(s) - 1])

def invr():
	return map(int, sysinput().split())
t = inp()
while t > 0:
	t -= 1
	(a, b) = inlt()
	diff = abs(a - b)
	num = diff // 10
	if num * 10 != diff:
		num += 1
	print(num)


import math

def int_prob():
	t = int(input())
	for _ in range(t):
		li = list(map(int, input().split()))
		print(math.ceil((max(li) - min(li)) / 10))
int_prob()


for _ in range(int(input())):
	(n, m) = [int(x) for x in input().split()]
	if n <= m:
		if m == n or m - n == 1:
			print(m - n)
		elif (m - n) % 2 == 0:
			print('2')
		else:
			print('1')
	elif (n - m) % 2 == 0:
		print('1')
	else:
		print('2')


try:

	def count(a, b):
		count = 0
		k = 10
		diff = a - b
		while diff:
			if diff >= k:
				count += diff // k
				diff = diff - k * (diff // k)
				k = 10
			else:
				k -= 1
		return count
	for i in range(int(input())):
		(a, b) = list(map(int, input().split()))
		if a > b:
			print(count(a, b))
		else:
			print(count(b, a))
except:
	pass


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():
	t = II()
	for _ in range(t):
		(a, b) = MI()
		if a == b:
			ans = 0
		elif b - a > 0 and (b - a) % 2 or (a - b > 0 and (a - b) % 2 == 0):
			ans = 1
		else:
			ans = 2
		print(ans)
main()


import math
n = int(input())
for i in range(n):
	numbers = input()
	tokens = numbers.split()
	count = 0
	for (a, b) in zip(tokens[::2], tokens[1::2]):
		a = int(a)
		b = int(b)
	d = abs(a - b)
	ans = d / 10.0
	print(math.ceil(ans))


t = int(input())
req = []
for i in range(t):
	temp = input().split(' ')
	a = int(temp[0])
	b = int(temp[1])
	if a == b:
		req.append(0)
	elif a < b:
		if (b - a) % 2 == 1:
			req.append(1)
		else:
			req.append(2)
	elif (a - b) % 2 == 1:
		req.append(2)
	else:
		req.append(1)
for i in req:
	print(i)


import math
ans = []
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		x = 0
	else:
		x = math.ceil(abs((a - b) / 10))
	ans.append(x)
for x in ans:
	print(x)


def get_turn(a, b, k=10):
	t = 0
	while a != b:
		if abs(a - b) > k:
			div = abs(a - b) // k
			if a < b:
				a += k * div
			else:
				a -= k * div
			t += div
		else:
			a = b
			t += 1
	return t
number_of_sets = int(input())
for _ in range(number_of_sets):
	(a, b) = map(int, input().split(' '))
	print(get_turn(a, b))


def aoes(a, b):
	if a == b:
		return 0
	elif a < b:
		if (b - a) % 2 == 1:
			return 1
		else:
			return 2
	elif (a - b) % 2 == 0:
		return 1
	else:
		return 2
t = int(input())
for i in range(0, t):
	ab = input().split()
	a = int(ab[0])
	b = int(ab[1])
	print(aoes(a, b))


def shakalakaBoomBoom(a, b):
	diff = abs(a - b)
	count = 0
	while diff != 0:
		rr = diff % 10
		if rr != 0:
			diff = diff - rr
			count += 1
		else:
			l = diff // 10
			diff = diff - l * 10
			count += l
	return count
t = int(input())
arr = []
for _ in range(t):
	(a, b) = map(int, input().split())
	x = shakalakaBoomBoom(a, b)
	arr.append(x)
for values in arr:
	print(values)


t = int(input())
out = []
for i in range(0, t):
	tmp = input().split(' ')
	a = int(tmp[0])
	b = int(tmp[1])
	out.append((abs(a - b) + 9) // 10)
print(*out, sep='\n')


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	diffrence = abs(a - b)
	move_1 = diffrence // 10
	moves = diffrence % 10
	if diffrence % 10 == 0:
		temp = 0
	else:
		temp = 1
	total = move_1 + temp
	print(total)


def main():
	outputs = []
	for __ in range(int(input())):
		(a, b) = list(map(int, input().split()))
		i = 10
		moves = 0
		while b != a and i >= 1:
			if a > b and a - b >= i:
				moves += (a - b) // i
				a -= (a - b) // i * i
			elif b > a and b - a >= i:
				moves += (b - a) // i
				a += (b - a) // i * i
			i -= 1
		outputs.append(moves)
	for output in outputs:
		print(output)
main()


import math

def moves_to_same(a, b):
	return math.ceil(abs(a - b) / 10)
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(moves_to_same(a, b))


t = int(input())
resultList = []
while t > 0:
	(a, b) = [int(i) for i in input().split()]
	rest = abs(a - b)
	moves = 0
	if a > b:
		if rest % 2 == 0:
			moves = 1
		else:
			moves = 2
	elif a < b:
		if rest % 2 == 0:
			moves = 2
		else:
			moves = 1
	resultList.append(moves)
	t -= 1
for result in resultList:
	print(result)


import math
t = int(input())
while t:
	(a, b) = [int(x) for x in input().split()]
	c = abs(a - b)
	ans = math.ceil(c / 10)
	print(ans)
	t -= 1


from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf

def sp():
	return map(int, input().split())
t = int(input())
for _ in range(t):
	(a, b) = sp()
	print(ceil(abs(b - a) / 10))


from sys import stdin

def get_user_input():
	return list(map(int, stdin.readline().rstrip().split()))

def calculate(num):
	if num <= 0:
		return 0
	res = 1
	fact = 1
	temp_num = num // 10
	if num % 10 <= 0:
		res = 0
	while temp_num > 0:
		t = temp_num % 10
		temp_num = temp_num // 10
		res += fact * t
		fact *= 10
	return res
n = int(input())
output_list = []
for i in range(n):
	in_case = get_user_input()
	output_list.append(calculate(abs(in_case[0] - in_case[1])))
for out in output_list:
	print(out)


from math import ceil
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(ceil((max(a, b) - min(a, b)) / 10))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = abs(b - a)
	if c == 0:
		print(0)
	elif c < 9:
		print(1)
	else:
		d = c // 10
		e = c % 10
		if e == 0:
			print(d)
		else:
			print(d + 1)


from sys import stdout
from sys import stdin

def get():
	return stdin.readline().strip()

def getf():
	return [int(i) for i in get().split()]

def put(a, end='\n'):
	stdout.write(str(a) + end)

def putf(a, sep=' ', end='\n'):
	stdout.write(sep.join(map(str, a)) + end)

def solve(a, b):
	return (b - a) // 10 + int((b - a) % 10 != 0)

def main():
	t = int(get())
	for i in range(t):
		(a, b) = getf()
		put(solve(min(a, b), max(a, b)))
main()


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


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split(' '))
	if a > b:
		(a, b) = (b, a)
	print((b - a + 9) // 10)


t = int(input())
while t > 0:
	user_input = str(input())
	values = [int(x) for x in user_input.split()]
	a = values[0]
	b = values[1]
	if a != b:
		if max(a, b) == a:
			if (a - b) % 2 == 0:
				print('1')
			else:
				print('2')
		elif (a - b) % 2 == 0:
			print('2')
		else:
			print('1')
	else:
		print('0')
	t -= 1


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


import math
n = int(input())
for i in range(0, n):
	nums = input().split(' ')
	a = int(nums[0])
	b = int(nums[1])
	print(math.ceil(abs(a - b) / 10))


import sys
import math
from collections import Counter

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

def printt(n):
	sys.stdout.write(str(n) + '\n')

def listt():
	return [int(i) for i in inputt().split()]

def gcd(a, b):
	return math.gcd(a, b)

def lcm(a, b):
	return a * b / gcd(a, b)
t = int(inputt())
for _ in range(t):
	(a, b) = map(int, inputt().split())
	d = abs(b - a)
	count = 0
	while d != 0:
		if d >= 10:
			n = d // 10
			d = d % 10
			count += n
		else:
			d = 0
			count += 1
	printt(count)


import sys

def main():
	l = []
	n = int(input())
	for i in range(n):
		(a, b) = map(int, input().split())
		if a == b:
			l.append(0)
		elif (a - b) % 2 == 0:
			if a > b:
				l.append(1)
			else:
				l.append(2)
		elif a > b:
			l.append(2)
		else:
			l.append(1)
		print(l[i])
main()


def task_A():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		print(abs(a - b) // 10 + int(bool((a - b) % 10)))

def main():
	task_A()
main()


import math
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	moves = 0
	diff = abs(a - b)
	moves += math.ceil(diff / 10)
	print(moves)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	count = 0
	temp = abs(x - y)
	count += temp // 10
	if temp % 10 > 0:
		print(count + 1)
	else:
		print(count)


import math
t = int(input())
while t:
	(a, b) = list(map(int, input().split()))
	m = a - b
	if m == 0:
		print(0)
	elif m < 0:
		if abs(m) % 2 == 0:
			print(2)
		elif abs(m) % 2 == 1:
			print(1)
	elif m > 0:
		if abs(m) % 2 == 1:
			print(2)
		elif abs(m) % 2 == 0:
			print(1)
	t = t - 1


import math
t = int(input())
for i in range(0, t):
	(x, y) = map(int, input().split())
	if x == y:
		print(0)
	else:
		ans = math.ceil(abs((x - y) / 10))
		print(ans)


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


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		h = abs(a - b)
		y = h // 10
		h -= y * 10
		if h > 0:
			y += 1
		print(y)


def solve(a, b):
	res = 0
	if a == b:
		return 0
	if a > b:
		if a - b <= 10:
			res = 1
		else:
			res = (a - b) // 10
			if (a - b) % 10 > 0:
				res += 1
		return res
	else:
		(a, b) = (b, a)
		if a - b <= 10:
			res = 1
		else:
			res = (a - b) // 10
			if (a - b) % 10 > 0:
				res += 1
		return res

def main():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		print(solve(a, b))
main()


testcases = int(input())
for testcase in range(testcases):
	temparr = input()
	temparr = temparr.split()
	a = int(temparr[0])
	b = int(temparr[1])
	lower = min(a, b)
	higher = max(a, b)
	diff = higher - lower
	if diff == 0:
		print(0)
		continue
	ans = diff // 10
	diff -= ans * 10
	if diff != 0:
		ans += 1
	print(ans)


for i in range(int(input())):
	count = 0
	(a, b) = map(int, input().split())
	d = abs(a - b)
	count = d // 10 if d % 10 == 0 else d // 10 + 1
	print(count)


import math
for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a > b:
		e = math.ceil((a - b) / 10)
		print(e)
	elif a < b:
		e = math.ceil((b - a) / 10)
		print(e)


for q in [*open(0)][1:]:
	(a, b) = map(int, q.split())
	print(0 - -abs(a - b) // 10)


def solve():
	T = int(input())
	ans = [0] * T
	for t in range(T):
		(a, b) = map(int, input().split())
		ans[t] = 0 - -abs(a - b) // 10
	return ans
print(*solve(), sep='\n')


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


def solve():
	(a, b) = map(int, input().split())
	x = abs(a - b)
	cnt = x // 10 + (x % 10 != 0)
	print(cnt)
t = int(input())
while t:
	solve()
	t -= 1


from sys import stdin, stdout
from math import gcd, sqrt
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
for _ in range(I()):
	(a, b) = R()
	if a > b:
		print((a - b) % 2 + 1)
	elif a < b:
		print((b - a + 1) % 2 + 1)
	else:
		print(0)


tc = int(input())
import math
for _ in range(tc):
	(a, b) = [int(x) for x in input().split()]
	ans = math.ceil(abs(a - b) / 10)
	print(ans)


t = int(input())
for _ in range(t):
	(a1, b1) = map(int, input().split())
	if a1 == b1:
		print(0)
	elif a1 < b1:
		x = abs(b1 - a1)
		if x % 2 == 0:
			print(2)
		else:
			print(1)
	else:
		x = abs(b1 - a1)
		if x % 2 == 0:
			print(1)
		else:
			print(2)


import math

def find_number(a, b):
	moves = 0
	diff = math.fabs(a - b)
	moves = diff // 10
	moves = int(moves)
	if diff % 10 == 0:
		print(moves)
	else:
		print(moves + 1)
test_number = int(input())
cases = []
for i in range(test_number):
	(a, b) = input().split()
	cases.append([int(a), int(b)])
for pair in cases:
	find_number(pair[0], pair[1])


t = int(input())
for i in range(t):
	parts = input().split()
	diff = abs(int(parts[0]) - int(parts[1]))
	if diff % 10 == 0:
		print(diff // 10)
	else:
		print(diff // 10 + 1)


from collections import defaultdict as dd
from sys import stdin, stdout
from math import log
for t in range(int(input())):
	(a, b) = map(int, stdin.readline().strip().split())
	a = abs(a - b)
	if a % 10:
		stdout.write(str(a // 10 + 1) + '\n')
	else:
		stdout.write(str(a // 10) + '\n')


from math import ceil
T = int(input())
for i in range(T):
	(a, b) = (int(i) for i in input().split())
	print(ceil(abs(a - b) / 10))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif b > a:
		ans = (b - a) // 10
		if (b - a) % 10 > 0:
			ans += 1
		print(ans)
	else:
		(a, b) = (max(a, b), min(a, b))
		ans = (a - b) // 10
		if (a - b) % 10 > 0:
			ans += 1
		print(ans)


def func(a, b):
	if a < b:
		(a, b) = (b, a)
	s = a - b
	if s % 10:
		print(s // 10 + 1)
	else:
		print(s // 10)
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	func(n, m)


def check(nums):
	a = nums[0]
	b = nums[1]
	if b >= a:
		temp = b - a
		if temp == 0:
			return 0
		elif temp % 2 == 0:
			return 2
		else:
			return 1
	else:
		temp = a - b
		if temp % 2 == 0:
			return 1
		else:
			return 2
t = int(input().rstrip())
result = list()
for i in range(t):
	temp = list(map(int, input().rstrip().split()))
	a = temp[0]
	b = temp[1]
	result.append((a, b))
for i in result:
	print(check(i))


import sys
import math

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

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

def iinp():
	return int(input())

def ninp():
	return map(int, sys.stdin.readline().strip().split())

def linp():
	return list(map(int, sys.stdin.readline().strip().split()))

def p(a):
	print(a)
for _ in range(iinp()):
	(a, b) = ninp()
	x = abs(a - b)
	if x % 10 == 0:
		print(x // 10)
	else:
		print(x // 10 + 1)


ans = []
for t in range(int(input())):
	[a, b] = [int(i) for i in input().split()]
	an = 0
	if a < b:
		if (b - a) % 2 == 0:
			an = 2
		else:
			an = 1
	elif b < a:
		if (a - b) % 2 == 0:
			an = 1
		else:
			an = 2
	ans.append(str(an))
print('\n'.join(ans))


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().rstrip().split()))
	if a > b:
		(a, b) = (b, a)
	m = (b - a) // 10
	if (b - a) % 10 != 0:
		m += 1
	print(m)


test = int(input())
for q in range(test):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	if x % 10 == 0:
		print(x // 10)
	else:
		print(x // 10 + 1)


def addOddSubEven(a, b):
	if a == b:
		return 0
	n = abs(b - a) % 2
	if a < b and n == 0 or (a > b and n == 1):
		return 2
	else:
		return 1
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split(' ')))
	print(addOddSubEven(a, b))


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


t = int(input())
while t > 0:
	(a, b) = map(int, input().split(' '))
	if a == b:
		print(0)
	else:
		if a < b:
			diff = b - a
		else:
			diff = a - b
		if diff <= 10:
			print(1)
		elif diff % 10 == 0:
			print(diff // 10)
		elif diff % 10 != 0:
			print(diff // 10 + 1)
	t -= 1


import math
m = int(input())
for i in range(m):
	n = input()
	for i in range(len(n)):
		if n[i] == ' ':
			d = [n[0:i] for x in range(0, i)]
			e = [n[i + 1:len(n)] for x in range(i + 1, len(n))]
			a = int(d[0])
			b = int(e[0])
	if a > b:
		c = a - b
	elif a < b:
		c = b - a
	elif a == b:
		c = -1
	change = c / 10
	change = math.ceil(change)
	print(change)


import math

def mayne():
	for _ in range(int(input())):
		(be, ah) = (int(x) for x in input().split())
		if ah < be:
			(ah, be) = (be, ah)
		sea = 0
		sea = math.ceil((ah - be) / 10)
		print(sea)
mayne()


test = int(input())
for _ in range(test):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	x = abs(a - b)
	z = x // 10
	y = x % 10
	print(z + int(y > 0))


def number_of_moves(a, b):
	k = 0
	if a > b:
		k = a - b
	else:
		k = b - a
	if k % 10 == 0:
		return k // 10
	else:
		return k // 10 + 1
n = int(input())
a = []
b = []
for i in range(n):
	(c, d) = map(int, input().split())
	a.append(c)
	b.append(d)
for i in range(n):
	print(number_of_moves(a[i], b[i]))


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	x = abs(b - a)
	ans = 0
	if x == 0:
		ans = 0
	elif x <= 10:
		ans += 1
	else:
		ans += x // 10
		if x % 10 != 0:
			ans += 1
	print(ans)
	t -= 1


t = int(input())
while t > 0:
	s = input().split()
	a = int(s[0])
	b = int(s[1])
	c = abs(b - a)
	e = int(c / 10)
	m = c % 10
	if m > 0:
		e += 1
	print(e)
	t -= 1


t = int(input())
for i in range(0, t):
	(a, b) = map(int, input().split())
	x = 0
	y = 0
	c = 0
	if a == b:
		print('0')
	elif a < b:
		if (b - a) % 2 == 0:
			x = (b - a) / 2
			while a != b:
				a += x
				c += 1
			print(c)
		else:
			print('1')
	else:
		if (b - a) % 2 == 0:
			print('1')
		else:
			y = a - b + 1
			x = 1
			a += x
			a -= y
		if a == b:
			print('2')


for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	n_min = 0
	n = 0
	if a == b:
		n_min = 0
	else:
		n = abs(a - b) // 10
		if abs(a - b) % 10 != 0:
			n_min = n + 1
		else:
			n_min = n
	print(n_min)


sol = []
n = int(input())

def solve(m, n):
	if m == n:
		return 0
	elif m % 2 == n % 2 and m > n or (m % 2 != n % 2 and m < n):
		return 1
	else:
		return 2
for i in range(n):
	l = list(map(int, input().split()))
	(m, n) = (l[0], l[1])
	sol.append(solve(m, n))
for i in sol:
	print(i)


import math
x = int(input())
for i in range(0, x):
	count = 0
	k = 0
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	while a != b:
		if a - b >= 10:
			k = math.floor((a - b) / 10)
			k = int(k)
			a = a - k * 10
			count = count + k
		elif a - b <= -10:
			k = math.floor((b - a) / 10)
			a = a + k * 10
			count = count + k
		elif a > b and abs(a - b) < 10:
			k = a - b
			a = a - k
			count += 1
		elif a < b and abs(a - b) < 10:
			k = b - a
			a = a + k
			count += 1
	if a == b:
		print(count)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	l = abs(a - b)
	count = 0
	if l % 10 != 0:
		count += 1
	l //= 10
	x = 1
	while l != 0:
		y = l % 10
		count += x * y
		l //= 10
		x *= 10
	print(count)


import math
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	ans = diff // 10
	if diff % 10 != 0:
		ans += 1
	print(ans)


import math
for i in range(int(input())):
	(l, k) = map(int, input().split())
	mini = min(l, k)
	maxi = max(l, k)
	digits = [0] * 11
	if mini != maxi:
		while True:
			val = abs(maxi - mini)
			if val > 10:
				count = val / 10
				(fractional, whole) = math.modf(count)
				digits[10] += whole
				if fractional != 0:
					digits[int(fractional * 10)] += 1
				break
			else:
				digits[val] += 1
				break
	print(int(sum(digits)))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	steps = diff // 10 + 1 * (diff % 10 != 0)
	print(steps)


T = int(input())
for _ in range(T):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	sub = abs(a - b)
	if sub == 0:
		print(0)
		continue
	if a > b:
		if sub % 2 == 0:
			print(1)
			continue
		else:
			print(2)
			continue
	if a < b:
		if sub % 2 == 0:
			print(2)
			continue
		else:
			print(1)
			continue


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	print((abs(a - b) + 9) // 10)
	t -= 1


for _ in range(int(input())):
	(a, b) = sorted(list(map(int, input().split())))
	d = b - a
	c = 0
	for i in range(10, 0, -1):
		c = d // i
		d = d - d // i
	print(c)


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


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	diff = abs(x - y)
	if x == y:
		print(0)
	elif x > y:
		if diff & 1:
			print(2)
		else:
			print(1)
	elif diff & 1:
		print(1)
	else:
		print(2)


test_cases = int(input())
queries = []
for _ in range(test_cases):
	queries.append(list(map(int, input().rstrip().split())))
for individual in queries:
	a = individual[0]
	b = individual[1]
	if a == b:
		print(0)
	else:
		n1 = int(abs(b - a) / 10)
		if abs(b - a) % 10 == 0:
			print(n1)
		else:
			print(n1 + 1)


t = int(input())
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if a == b:
		print('0')
	else:
		diff = abs(a - b)
		if a < b:
			temp = a
			a = b
			b = temp
		ct = 0
		i = 10
		while diff != 0 and i >= 1:
			if diff >= i:
				a = diff // i
				ct += a
				diff = diff - i * a
				i = i - 1
			else:
				i = i - 1
		print(ct)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(c, d) = (max(a, b), min(a, b))
	x = (c - d) // 10
	if (c - d) % 10 == 0:
		print(x)
	else:
		print(x + 1)


t = int(input())
for x in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	diff = abs(a - b)
	ans = diff / 10
	if diff % 10 != 0:
		ans += 1
	print(int(ans))


def findMoves(a, b):
	if a == b:
		return 0
	toCover = abs(a - b)
	if toCover % 10:
		extra = 1
	else:
		extra = 0
	return toCover // 10 + extra
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(findMoves(a, b))


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	z = abs(b - a)
	if z == 0:
		print(0)
	elif z <= 10:
		print(1)
	else:
		zz = z // 10
		if z % 10 != 0:
			print(int(zz) + 1)
		else:
			print(int(zz))


import math

def solve(a, b):
	x = abs(a - b)
	return math.ceil(x / 10)
for i in range(int(input())):
	(a, b) = map(int, input().split())
	print(solve(a, b))


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	elif a > b:
		c = a - b
	elif a < b:
		c = b - a
	print(math.ceil(c / 10))


numbertests = int(input())
l = []
for i in range(numbertests):
	temp = []
	temp = [int(i) for i in input().split()]
	l = l + temp
itr = int(len(l) / 2)
for i in range(itr):
	if l[2 * i + 1] == l[2 * i]:
		print(0)
	elif l[2 * i + 1] > l[2 * i]:
		diff = l[2 * i + 1] - l[2 * i]
		if diff % 2 == 0:
			print(2)
		else:
			print(1)
	else:
		diff = l[2 * i] - l[2 * i + 1]
		if diff % 2 == 0:
			print(1)
		else:
			print(2)
	print()


for t in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	if a > b:
		(a, b) = (b, a)
	diff = b - a
	count = diff // 10
	diff -= 10 * count
	count += 1 if diff != 0 else 0
	print(count)


testcases = int(input())
for i in range(testcases):
	(num1, num2) = [int(i) for i in input().split()]
	if num1 == num2:
		print('0')
	else:
		absolute = abs(num1 - num2)
		if absolute % 10 == 0:
			print(int(absolute / 10))
		else:
			print(int(absolute / 10) + 1)


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


import math
t = int(input())
ans = []
for i in range(t):
	(a, b) = [int(i) for i in input().split()]
	diff = max(a, b) - min(a, b)
	if diff == 0:
		ans.append(0)
	else:
		ans.append(math.ceil(diff / 10))
for i in ans:
	print(i)


t = int(input())
for i in range(t):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	if a > b:
		d = a - b
	else:
		d = b - a
	print(int((d + 9) / 10))


q = int(input())
for d in range(q):
	(n, m) = map(int, input().split(' '))
	if n == m:
		print(0)
	elif n > m:
		temp = n - m
		if temp % 10 == 0:
			temp2 = temp // 10
			print(temp2)
		else:
			temp2 = temp // 10
			print(temp2 + 1)
	else:
		temp = m - n
		if temp % 10 == 0:
			temp2 = temp // 10
			print(temp2)
		else:
			temp2 = temp // 10
			print(temp2 + 1)


import sys
import collections as cc
I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	(a, b) = I()
	now = abs(b - a)
	ans = now // 10
	if now % 10:
		ans += 1
	print(ans)


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


for t in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	out = 0
	b -= a
	out += b // 10
	if b % 10 != 0:
		out += 1
	print(out)


n = int(input())

def calculate(a, b):
	if a == b:
		print('0')
	else:
		dif = abs(a - b)
		if dif % 2 == 0:
			if a < b:
				print(2)
			else:
				print(1)
		elif a > b:
			print(2)
		else:
			print(1)
for i in range(n):
	calculate(*map(int, input().split()))


n = int(input())
for i in range(n):
	inp = input()
	a = int(inp.split()[0])
	b = int(inp.split()[1])
	count = 0
	while a != b:
		if a > b:
			a -= a - b + (a - b) % 2
			count += 1
		else:
			a += b - a if (b - a) % 2 != 0 else b - a - 1
			count += 1
	print(count)


def main(a, b):
	if a == b:
		return 0
	if a < b:
		if (b - a) % 2 != 0:
			return 1
		else:
			return 2
	elif a > b:
		if (a - b) % 2 == 0:
			return 1
		else:
			return 2
t = int(input())
for t_itr in range(t):
	ab = list(map(int, input().rstrip().split()))
	a = ab[0]
	b = ab[1]
	res = main(a, b)
	print(res)


def min_moves(x, y):
	moves = 0
	if x - y == 0:
		return moves
	diff = abs(x - y)
	if diff % 10 == 0:
		moves = moves + diff // 10
	else:
		moves = moves + 1 + diff // 10
	return moves
t = int(input())
for i in range(t):
	num = input().split()
	a = int(num[0])
	b = int(num[1])
	result = min_moves(a, b)
	print(result)


def modify(a, b):
	count = 0
	if a == b:
		return count
	count += 1
	diff = a - b
	if diff < 0:
		if diff % 2 == 0:
			return count + 1
		else:
			return count
	elif diff % 2 == 0:
		return count
	else:
		return count + 1
t = int(input())
for case in range(t):
	(a, b) = [int(x) for x in input().split()]
	modifications = modify(a, b)
	print(modifications)


for _ in range(int(input())):
	(n, k) = map(int, input().rstrip().split())
	c = abs(n - k)
	if c % 10 == 0:
		print(c // 10)
	else:
		print(c // 10 + 1)


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


def answer(a, b):
	x = abs(a - b)
	k = x % 10
	if k > 0:
		return x // 10 + 1
	else:
		return x // 10
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(answer(a, b))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	print(c // 10 + bool(c % 10))


a = int(input())
for x in range(a):
	(c, b) = [int(x) for x in input().split()]
	d = c % 2
	e = b % 2
	if c == b:
		print(0)
		continue
	if c - b == 1:
		print(2)
		continue
	if b - c == 1:
		print(1)
		continue
	if c > b:
		if d == 0 and e == 1:
			print(2)
		elif d == e == 0:
			print(1)
		elif d == e == 1:
			print(1)
		else:
			print(2)
	elif c < b:
		if d == 0 and e == 1:
			print(1)
		elif d == e == 0:
			print(2)
		elif d == e == 1:
			print(2)
		else:
			print(1)


import sys
t = int(input())
for i in range(t):
	c = 0
	args = input().split()
	a = int(args[0])
	b = int(args[1])
	if a == b:
		print(0)
		continue
	if b > a:
		(b, a) = (a, b)
	c = int((a - b) / 10)
	print(c + 1 if (a - b) % 10 != 0 else c)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(-(-abs(a - b) // 10))


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


x = int(input())
import math
for i in range(x):
	(a, b) = map(int, input().split())
	y = abs(a - b)
	if y % 10 == 0:
		print(int(y / 10))
	else:
		print(math.ceil(y / 10))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = 0
	if a < b:
		if (b - a) % 10 == 0:
			c += -1
		c += (b - a) // 10 + 1
	elif a > b:
		if (a - b) % 10 == 0:
			c += -1
		c += (a - b) // 10 + 1
	print(c)


ar = []
for i in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	ar.append((abs(a - b) + 9) / 10)
for ans in ar:
	print(int(ans))


import math

def ii():
	return int(input())

def si():
	return input()

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

def mi():
	return map(int, input().split())

def dpc(a, b):
	return [[0] * b for i in range(a)]

def solve():
	(a, b) = mi()
	if a == b:
		print(0)
	elif abs(a - b) % 10 == 0:
		print(abs(a - b) // 10)
	else:
		print(abs(a - b) // 10 + 1)
t = ii()
for _ in range(t):
	solve()


def ans():
	N = int(input())
	for i in range(N):
		anss = 0
		c = input().split()
		a = int(c[0])
		b = int(c[1])
		if (a - b) % 10 != 0:
			anss = abs(a - b) // 10 + 1
		else:
			anss = abs(a - b) // 10
		print(anss)
ans()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	diff = a - b if a > b else b - a
	mod = 1 if diff % 10 > 0 else 0
	ans = diff // 10 + mod
	print(ans)


for j in range(int(input())):
	l = list(map(int, input().split()))
	subs = abs(l[0] - l[1])
	ans = 0
	for i in range(10, 0, -1):
		div = subs // i
		if div > 0:
			ans += div
			subs = subs % i
			if subs == 0:
				break
	print(ans)


n = int(input())
cases = [map(int, input().split()) for _ in range(n)]

def even(n):
	if n % 2 == 0:
		return True
	return False
for case in cases:
	(a, b) = case
	dif = abs(a - b)
	if a == b:
		print(0)
	elif even(dif):
		if a > b:
			print(1)
		else:
			print(2)
	elif a > b:
		print(2)
	else:
		print(1)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	c1 = 0
	if c == 0:
		print(0)
	else:
		if c % 2 == 0:
			if a > b:
				c1 = 1
			else:
				d = c - 1
				c1 = 2
		elif a < b:
			c1 = 1
		else:
			c1 = 2
		print(c1)


def ans(a, b):
	if a == b:
		return '0'
	res = 0
	res = (a - b) // 10
	if (a - b) % 10 == 0:
		return res
	return res + 1
t = int(input())
for i in range(t):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	if a < b:
		(a, b) = (b, a)
	print(ans(a, b))


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


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	r = d // 10
	if d % 10 > 0:
		r += 1
	print(r)


n = int(input())
l = list()
for _ in range(n):
	ans = 0
	(a, b) = [int(i) for i in input().split()]
	if a != b:
		t = abs(a - b) % 10 == 0
		if t:
			ans = abs(a - b) // 10
		else:
			ans = abs(a - b) // 10 + 1
	l.append(ans)
for t in l:
	print(t)


T = int(input())
for q in range(1, T + 1):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a < b and a & 1 != b & 1 or (a > b and a & 1 == b & 1):
		print(1)
	else:
		print(2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = a - b if a >= b else b - a
	print((c + 9) // 10, flush=True)


t = int(input())

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


from sys import stdin

def solve():
	(a, b) = 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()


n = int(input())
while n:
	(a, b) = [int(a) for a in input().split()]
	if b - a > 0:
		if (b - a) % 2 == 0:
			print(2)
		else:
			print(1)
	elif b - a < 0:
		if (b - a) % 2 == 0:
			print(1)
		else:
			print(2)
	else:
		print(0)
	n -= 1


from sys import stdin, stdout
t = int(stdin.readline())
for _ in range(t):
	(a, b) = map(int, stdin.readline().split())
	if a != b:
		c = abs(a - b)
		if a < b:
			if c & 1:
				stdout.write('1\n')
			else:
				stdout.write('2\n')
		elif c & 1:
			stdout.write('2\n')
		else:
			stdout.write('1\n')
	else:
		stdout.write('0\n')


import math
for i in range(int(input())):
	(a, b) = [*map(int, input().split())]
	if a == b:
		print('0')
	else:
		print(math.ceil(math.fabs(b - a) / 10))


def f(a, b):
	if a == b:
		return 0
	if a < b and (a + b) % 2 == 1:
		return 1
	if a < b and (a + b) % 2 == 0:
		return 2
	if a > b and (a + b) % 2 == 1:
		return 2
	if a > b and (a + b) % 2 == 0:
		return 1
for i in range(int(input())):
	(a, b) = map(int, input().split())
	print(f(a, b))


for I in range(int(input())):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	temp = diff // 10
	if diff % 10 == 0:
		print(temp)
	else:
		print(temp + 1)


for t in range(int(input())):
	(a, b) = map(int, input().split())
	diff = abs(b - a)
	res = diff // 10
	overflow = diff % 10
	if overflow != 0:
		flag = 1
	else:
		flag = 0
	final = res + flag
	print(final)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	diff = abs(a - b)
	if a < b:
		if diff % 2 == 0:
			print(2)
		elif diff % 2 == 1:
			print(1)
	elif a > b:
		if diff % 2 == 0:
			print(1)
		if diff % 2 == 1:
			print(2)


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


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	count = 0
	diff = b - a
	diff = -diff if diff < 0 else diff
	count = diff // 10
	count += 1 if diff % 10 else 0
	print(count)


t = int(input())
while t > 0:
	(x, y) = list(map(int, input().split()))
	if x == y:
		print(0)
	elif x > y and (x - y) % 2 == 0 or (x < y and (x - y) % 2 != 0):
		print(1)
	else:
		print(2)
	t -= 1


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()
	v = abs(a - b)
	print(math.ceil(v / 10))
query_count = Read.int()
while query_count:
	query_count -= 1
	solve()


from sys import stdin, stdout
import traceback
read = stdin.readline
write = stdout.write
writeln = lambda x: write(str(x) + '\n')

def reads(typ=int):
	return list(map(typ, read().split()))

class Sol:

	@classmethod
	def input(cls):
		s = cls()
		return s

	def solve(self):
		(a, b) = reads()
		if a == b:
			return 0
		odd = (b - a) % 2
		if b > a:
			if odd:
				return 1
			else:
				return 2
		elif odd:
			return 2
		else:
			return 1
try:
	for _ in range(int(read())):
		writeln(Sol.input().solve())
except Exception as e:
	print('Got exception:', repr(e))
	print(traceback.format_exc())


import math

def func(n):
	for _ in range(n):
		(a, b) = map(int, input().split())
		if abs(a - b) == 0:
			k.append('0')
		elif abs(a - b) > 0:
			k.append(str(math.ceil(abs(a - b) / 10)))
	print('\n'.join(k))
k = []
func(int(input()))


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


import sys, os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
sys.setrecursionlimit(10 ** 5)

def ii():
	return int(sys.stdin.readline())

def mi():
	return map(int, sys.stdin.readline().split())

def li():
	return list(map(int, sys.stdin.readline().split()))
print = sys.stdout.write

def solve():
	(a, b) = mi()
	r = abs(a - b)
	c = r % 10
	d = r // 10
	if c == 0:
		print(str(d) + '\n')
	else:
		print(str(d + 1) + '\n')
for _ in range(ii()):
	solve()


t = int(input())
while t > 0:
	(a, b) = [int(i) for i in input().split()]
	if a == b:
		print(0)
	elif b > a:
		x = b - a
		if x % 10 != 0:
			c = x // 10 + 1
			print(c)
		else:
			c = x // 10
			print(c)
	elif a > b:
		x = a - b
		if x % 10 != 0:
			c = x // 10 + 1
			print(c)
		else:
			c = x // 10
			print(c)
	t = t - 1


q = int(input())
for i in range(q):
	(a, b) = [int(i) for i in input().split()]
	if a == b:
		print(0)
		continue
	if b > a:
		if b % 2 == a % 2:
			print(2)
		else:
			print(1)
	elif a % 2 != b % 2:
		print(2)
	else:
		print(1)


from sys import stdin
input = lambda : stdin.readline().strip()
for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	c = abs(a - b)
	nd = c // 10
	if c % 10 != 0:
		nd += 1
	print(nd)


n = int(input())
for i in range(n):
	k = list(map(int, input().split()))
	if k[0] < k[1] and sum(k) % 2 == 1 or (k[0] > k[1] and sum(k) % 2 == 0):
		print('1')
	elif k[0] < k[1] and sum(k) % 2 == 0 or (k[0] > k[1] and sum(k) % 2 == 1):
		print('2')
	else:
		print('0')


from math import ceil
for t in range(int(input())):
	(a, b) = (int(x) for x in input().split())
	print(ceil(abs(b - a) / 10))


in1 = int(input())
for i in range(in1):
	inp2 = input().split()
	inp2 = list(map(int, inp2))
	if inp2[0] == inp2[1]:
		print(0)
	elif inp2[0] > inp2[1]:
		if inp2[0] % 2 == 0 and inp2[1] % 2 == 0:
			print(1)
		elif inp2[0] % 2 != 0 and inp2[1] % 2 != 0:
			print(1)
		else:
			print(2)
	elif inp2[0] % 2 == 0 and inp2[1] % 2 == 0:
		print(2)
	elif inp2[0] % 2 != 0 and inp2[1] % 2 != 0:
		print(2)
	else:
		print(1)


(n, l) = (int(input()), [])
for i in range(n):
	l.append([int(k) for k in input().split()])
	l[-1].sort()
for i in l:
	h = int((i[1] - i[0]) / 10)
	if i[1] - h * 10 == i[0]:
		print(h)
	else:
		print(h + 1)


def main():
	t = int(input())
	for i in range(t):
		(a, b) = input().split()
		print(FindAmountOp(int(a), int(b)))

def FindAmountOp(a, b):
	if a == b:
		return 0
	sub = a - b
	isEven = sub % 2 == 0
	if a > b:
		return 1 if isEven else 2
	else:
		return 1 if not isEven else 2
	return -1
main()


import math
for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	if a == b:
		print(0)
	else:
		c = abs(a - b)
		print(math.ceil(c / 10))


t = int(input())
i = 0
while i < t:
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	n = b - a
	if n < 0 and n % 2 == 0 or (n > 0 and n % 2 != 0):
		print(1)
	elif n == 0:
		print(0)
	else:
		print(2)
	i += 1


n = int(input())
t = [input() for i in range(n)]
for i in t:
	(a, b) = i.split()
	subs = abs(int(a) - int(b))
	if subs % 10 == 0:
		print(subs // 10)
	else:
		print(subs // 10 + 1)


def call(a, b):
	req = b - a
	req = abs(req)
	moves = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
	ans = req
	sumo = 0
	for i in range(10):
		curr = moves[i]
		sumo += ans // curr
		ans = ans % curr
	print(sumo)
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	call(a, b)


from sys import stdin, stdout
q = int(input())
for i in range(q):
	(a, b) = list(map(int, stdin.readline().split()))
	d = abs(a - b)
	if d == 0:
		print(0)
	elif d <= 10:
		print(1)
	else:
		f = d % 10
		e = d // 10
		if f == 0:
			print(f + e)
		else:
			print(e + 1)


import math
for i in range(int(input())):
	(a, b) = input().split()
	temp = abs(int(b) - int(a))
	ans = math.ceil(temp / 10)
	print(ans)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		diff = abs(a - b)
		print((diff + 9) // 10)


l = []
a = []
t = int(input())
for i in range(t):
	l = [int(x) for x in input().split()]
	if len(l) == 2:
		d = abs(l[0] - l[1])
		if d % 10 != 0:
			r = d // 10 + 1
		else:
			r = d // 10
		a.append(r)
for r in a:
	print(r)


n = int(input())
for _ in range(n):
	(m, l) = map(int, input().split())
	if abs(m - l) % 10 == 0:
		print(abs(m - l) // 10)
	elif m != l:
		print(abs(m - l) // 10 + 1)
	else:
		print('0')


def integers(a, b):
	value = abs(a - b)
	d = value // 10
	r = value % 10
	if r != 0:
		d += 1
	return d
t = int(input())
for i in range(t):
	(a, b) = tuple(map(int, input().split()))
	print(integers(a, b))


n = int(input())
list2 = []
for i in range(0, n):
	list1 = list(map(int, input().split()))
	list2.append(list1)
for i in list2:
	a = i[0]
	b = i[1]
	diff = abs(a - b)
	q = diff // 10
	rem = diff % 10
	if rem == 0:
		count = q
	else:
		count = q + 1
	print(count)


n = int(input())
for i in range(n):
	arr = list(map(int, input().split()))
	sum = 0
	if arr[0] == arr[1]:
		print(sum)
	elif arr[0] > arr[1]:
		x = arr[0] - arr[1]
		if x % 10 == 0:
			sum = int(x / 10)
		else:
			sum = int(x / 10) + 1
		print(sum)
	else:
		x = arr[1] - arr[0]
		if x % 10 == 0:
			sum = int(x / 10)
		else:
			sum = int(x / 10) + 1
		print(sum)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split(' '))
	if a == b:
		print(0)
		continue
	else:
		num = abs(b - a) // 10
		mod = abs(b - a) % 10
		if mod == 0:
			print(num)
		else:
			print(num + 1)


n = int(input())
arr = []
for i in range(n):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if a == b:
		arr.append(0)
	elif a < b:
		if (b - a) % 2 == 0:
			arr.append(2)
		else:
			arr.append(1)
	elif a > b:
		if (a - b) % 2 == 0:
			arr.append(1)
		else:
			arr.append(2)
for num in arr:
	print(num)


def func(a, b):
	if b < a:
		if (a - b) % 2 == 0:
			return 1
		else:
			return 2
	elif b > a:
		if (b - a) % 2 == 0:
			return 2
		else:
			return 1
	else:
		return 0
T = int(input())
for i in range(T):
	(a, b) = list(map(int, input().split()))
	print(func(a, b))


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)
	elif a == b:
		print(0)
	elif (a - b) % 2 == 0:
		print(1)
	else:
		print(2)


import math
t = int(input())

def olimp(a, b):
	if b - a < 0:
		return int(math.fabs(math.floor((b - a) / 10)))
	return math.ceil((b - a) / 10)
for i in range(t):
	z = input().split()
	print(olimp(int(z[0]), int(z[1])))


import math

def res(a, b):
	ans = abs(b - a)
	print(math.ceil(ans / 10))
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	res(a, b)


n = int(input())
for i in range(n):
	list1 = input().split(' ')
	count = 0
	x = 0
	x1 = 0
	x2 = 0
	(a, b) = (int(list1[0]), int(list1[1]))
	if a == b:
		print('0')
		continue
	if a != b:
		x = b - a
		x1 = abs(x) // 10
		count += abs(x1)
		if x % 10 > 0:
			count += 1
	print(count)


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(t,) = I()
while t:
	t -= 1
	(a, b) = I()
	ans = 1
	if a > b and (a - b) % 2 or (b > a and (not (b - a) % 2)):
		ans = 2
	if a == b:
		ans = 0
	print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	z = abs(a - b)
	print(z // 10 + int(z % 10 != 0))


def count(a, b):
	c = 0
	if a % 2 != 0:
		c += 1
	if b % 2 != 0:
		c += 1
	return c

def steps(a, b):
	if a == b:
		return 0
	if count(a, b) == 1 and b > a or (count(a, b) % 2 == 0 and b < a):
		return 1
	return 2
t = int(input())
for _ in range(t):
	(a, b) = [int(i) for i in input().split()]
	print(steps(a, b))


n = int(input())
for i in range(n):
	(x, y) = list(map(int, input().split()))
	if x == y:
		print(0)
	elif abs(y - x) % 2 == 0 and x < y or (abs(x - y) % 2 != 0 and x > y):
		print(2)
	else:
		print(1)


import sys
import math
inputs = []
res = []
userIn = int(input())
for i in range(0, userIn):
	(a, b) = input().split()
	x = [a, b]
	inputs.append(x)
for i in range(0, userIn):
	a = int(inputs[i][0])
	b = int(inputs[i][1])
	counter = 0
	multOfTen = abs(math.floor((a - b) / 10))
	if a == b:
		res.append(0)
	elif a < b:
		a += multOfTen * 10
		counter += multOfTen
		p = 9
		while a < b:
			if a + p <= b:
				a += p
				counter += 1
			elif a + p > b:
				p -= 1
		res.append(counter)
	elif a > b:
		a -= multOfTen * 10
		counter += multOfTen
		p = 9
		while a > b:
			if a - p >= b:
				a -= p
				counter += 1
			elif a - p < b:
				p -= 1
		res.append(counter)
for i in range(0, len(res)):
	print(res[i])


n = int(input())
while n > 0:
	(a, b) = map(int, input().split())
	if a == b:
		g = 0
		print(g)
	if a < b:
		s = b - a
		if s % 2 == 1:
			print('1')
		else:
			print('2')
	if a > b:
		s = a - b
		if s % 2 == 0:
			print('1')
		else:
			print('2')
	n = n - 1


t = int(input())
while t:
	t -= 1
	lst = list(map(int, input().split()))
	a = abs(lst[0] - lst[1])
	if a % 10:
		print(a // 10 + 1)
	else:
		print(a // 10)


import sys

def input():
	return sys.stdin.readline().rstrip()
for T in range(int(input())):
	(a, b) = map(int, input().split())
	if a - b == 0:
		output = 0
	elif a - b > 0:
		if (a - b) % 2 == 0:
			output = 1
		else:
			output = 2
	elif a - b < 0:
		if (a - b) % 2 == 0:
			output = 2
		else:
			output = 1
	print(output)


class Min_tem:

	def __init__(self, a, b):
		self.first = a
		self.second = b

	def compute(self):
		diff = abs(self.second - self.first)
		if diff == 0:
			return 0
		else:
			if diff % 10 == 0:
				return diff // 10
			return diff // 10 + 1
t = int(input())
for i in range(t):
	ls = [int(x) for x in input().split()]
	res = Min_tem(ls[0], ls[1])
	print(res.compute())


t = int(input())
for i in range(t):
	(x, y) = list(map(int, input().split()))
	solo = abs(x - y)
	if solo % 10 != 0:
		print(solo // 10 + 1)
	else:
		print(solo // 10)


cases = int(input())
while cases != 0:
	steps = 0
	inputArray = input().split()
	valueA = int(inputArray[0])
	valueB = int(inputArray[1])
	while valueB != valueA:
		difference = valueB - valueA
		if difference > 0 and difference % 2 != 0:
			valueA += difference
			steps += 1
		elif difference > 0 and difference % 2 == 0:
			valueA += difference - 1
			steps += 1
		elif difference < 0 and difference % 2 != 0:
			valueA += difference - 1
			steps += 1
		elif difference < 0 and difference % 2 == 0:
			valueA += difference
			steps += 1
	cases -= 1
	print(steps)


import sys
from math import ceil
t = [int(val) for val in sys.stdin.readline().split()][0]
for test in range(t):
	(a, b) = [int(val) for val in sys.stdin.readline().split()]
	diff = abs(a - b)
	print(ceil(diff / 10.0))


for iii in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a > b:
		x = a - b
		if x % 10 == 0:
			print(x // 10)
		else:
			print(x // 10 + 1)
	else:
		x = b - a
		if x % 10 == 0:
			print(x // 10)
		else:
			print(x // 10 + 1)


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


import math
t = int(input())
while t > 0:
	t -= 1
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		dif = abs(b - a)
		ans = math.ceil(dif / 10)
		print(ans)


t = int(input())
while t:
	(a, b) = map(int, input().strip().split())
	diff = abs(a - b)
	if diff % 10 != 0:
		print(diff // 10 + 1)
	else:
		print(diff // 10)
	t = t - 1


a = int(input())
i = 0
while i < a:
	b = input().split(' ')
	c = int(b[0])
	d = int(b[1])
	c = abs(c - d)
	if c % 10 == 0:
		print(c // 10)
	else:
		print(c // 10 + 1)
	i = i + 1


def findMin(V):
	if V % 10 == 0:
		ans = int(V / 10)
	else:
		ans = int(V / 10) + 1
	print(ans)
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	findMin(abs(a - b))


t = int(input())
s = []
for i in range(t):
	(a, b) = map(int, input().split(' '))
	q = abs(a - b)
	w = q // 10
	if q % 10 != 0:
		s.append(w + 1)
	else:
		s.append(w)
for i in s:
	print(i)


import math

def read_ints():
	return map(int, input().split())
t = int(input())
for i in range(t):
	a = []
	a = list(read_ints())
	dif = abs(a[0] - a[1])
	ans = math.ceil(dif / 10)
	print(ans)


import math
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a > b:
		if (a - b) % 10 != 0:
			print(math.ceil((a - b) / 10))
		else:
			print(math.floor((a - b) / 10))
	elif (b - a) % 10 != 0:
		print(math.ceil((b - a) / 10))
	else:
		print(math.floor((b - a) / 10))


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split(' ')))
	diff = abs(b - a)
	if diff == 0:
		print(0)
		continue
	r = diff // 10
	m = 1 if diff % 10 != 0 else 0
	print(r + m)


import math
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	c = abs(a - b)
	print(math.ceil(c / 10))


i = int(input())
for k in range(i):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	dif = abs(a - b)
	steps = 0
	steps += int(dif / 10)
	if dif % 10:
		steps += 1
	print(steps)


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


for _ in range(int(input())):
	(num, conv_num) = map(int, input().split())
	x = abs(conv_num - num)
	y = x // 10
	if x % 10 != 0:
		print(y + 1)
	else:
		print(y)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if x == y:
		print(0)
	else:
		out = abs(x - y)
		counter = out // 10
		if out % 10 != 0:
			counter += 1
		print(counter)


t = int(input())
while t > 0:
	(x, y) = list(map(int, input().split()))
	c = 0
	d = abs(y - x)
	if d % 10:
		c = d // 10 + 1
	else:
		c = int(d / 10)
	print(c)
	t -= 1


t = int(input())
ans = []
for _ in range(t):
	mov = 0
	(a, b) = map(int, input().split())
	while a != b:
		if b > a:
			if (b - a) % 2 == 0:
				a = a + (b - a) - 1
			else:
				a = a + (b - a)
		elif (a - b) % 2 == 0:
			a = a - (a - b)
		else:
			a = a - (a - b + 1)
		mov += 1
	ans.append(mov)
for i in ans:
	print(i)


for _ in range(int(input())):
	lst = list(map(int, input().split()))
	(a, b) = (lst[0], lst[1])
	answer = 0 - -abs(a - b) // 10
	print(answer)


def abs_val(n):
	return n if n >= 0 else -n

def solve():
	(a, b) = map(int, input().split())
	v = abs_val(b - a)
	c = v // 10 + (1 if v % 10 != 0 else 0)
	print(c)
for _ in range(int(input())):
	solve()


t = int(input())
new_list = []
result = []
for i in range(t):
	a = list(map(int, input().split()))
	new_list.append(a)
for item in new_list:
	x = item[0]
	y = item[1]
	if x < y and (y - x) % 2 == 0:
		result.append(2)
	elif x < y and (y - x) % 2 != 0:
		result.append(1)
	elif x > y and (x - y) % 2 == 0:
		result.append(1)
	elif x > y and (x - y) % 2 != 0:
		result.append(2)
	else:
		result.append(0)
print(*result, sep='\n')


import sys, io, os, time
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect, math, heapq
alphabet = 'abcdefghijklmnopqrstuvwxyz'
input = sys.stdin.readline
for ii in range(int(input())):
	(a, b) = map(int, input().split())
	diff = abs(b - a)
	print(math.ceil(diff / 10))


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


from sys import stdin
import math
t = int(stdin.readline().strip())
for i in range(t):
	l = list(map(int, stdin.readline().strip().split(' ')))
	a = l[0]
	b = l[1]
	if a > b:
		print(math.ceil((a - b) / 10))
	else:
		print(math.ceil((b - a) / 10))


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	ans = 0
	get = 0
	if a == b:
		print(0)
		continue
	elif a < b:
		get = b - a
		ans += 1
		if get % 2 == 0:
			ans += 1
	elif a > b:
		get = a - b
		ans += 1
		if get % 2 != 0:
			ans += 1
	print(ans)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(d, r) = divmod(abs(a - b), 10)
	print(d + bool(r))


t = int(input())
p = []
for i in range(t):
	y = list(map(int, input().split()))
	p.append(y)

def oe(a, b):
	if a == b:
		return 0
	if a % 2 == 0 and b % 2 == 0:
		if a > b:
			return 1
		else:
			return 2
	elif a % 2 == 0 and b % 2 != 0:
		if a < b:
			return 1
		else:
			return 2
	elif a % 2 != 0 and b % 2 == 0:
		if a < b:
			return 1
		else:
			return 2
	elif a < b:
		return 2
	else:
		return 1
for i in range(t):
	r = oe(p[i][0], p[i][1])
	print(r)


numCases = int(input())
for x in range(numCases):
	(a, b) = [*map(int, input().split())]
	if a % 2 == b % 2:
		diff = False
	else:
		diff = True
	if a > b:
		if diff:
			print('2')
		else:
			print('1')
	elif a < b:
		if diff:
			print('1')
		else:
			print('2')
	else:
		print('0')


t = int(input())
for q in range(t):
	(a, b) = list(map(int, input().split()))
	if a == b:
		ans = 0
	else:
		ans = abs(a - b) // 10
		if abs(a - b) % 10 == 0:
			pass
		else:
			ans = ans + 1
	print(ans)


def f(x):
	if x - int(x) > 0:
		return int(x) + 1
	return x
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	print(int(f(abs(x - y) / 10)))


n = int(input())
for u in range(n):
	(a, b) = [int(x) for x in input().split()]
	if a == b:
		print(0)
		continue
	if a % 2 != 0:
		if b % 2 == 0:
			if a > b:
				print(2)
			if a < b:
				print(1)
		if b % 2 != 0:
			if a > b:
				print(1)
			if a < b:
				print(2)
	if a % 2 == 0:
		if b % 2 == 0:
			if a > b:
				print(1)
			if a < b:
				print(2)
		if b % 2 != 0:
			if a > b:
				print(2)
			if a < b:
				print(1)


t = int(input())
for test in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif b > a:
		diff = b - a
		res = diff // 10
		res1 = diff % 10
		if res1 != 0:
			res = res + 1
		print(res)
	else:
		diff = a - b
		res = diff // 10
		res1 = diff % 10
		if res1 != 0:
			res = res + 1
		print(res)


from collections import defaultdict
from collections import Counter
from sys import setrecursionlimit as srl
srl(2 * 10 ** 6)

def solve(a, b):
	diff = abs(b - a)
	moves = 0
	moves += diff // 10
	rem = diff % 10
	if rem:
		moves += 1
	return moves
t = int(input())
while t:
	(n, m) = map(int, input().split())
	print(solve(n, m))
	t -= 1


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


import sys, os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
sys.setrecursionlimit(10 ** 5)

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))
print = sys.stdout.write

def solve():
	(a, b) = MI()
	if a > b:
		if (a - b) % 2 == 0:
			print('1\n')
		else:
			print('2\n')
	elif a == b:
		print('0\n')
	elif (b - a) % 2 == 0:
		print('2\n')
	else:
		print('1\n')
for _ in range(II()):
	solve()


t = int(input())
while t > 0:
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	x = 0
	while True:
		if a == b:
			break
		elif a < b:
			if (b - a) % 2 != 0:
				x = 1
				break
			else:
				x = 2
				break
		elif (a - b) % 2 != 0:
			x = 2
			break
		else:
			x = 1
			break
	print(x)
	t -= 1


t = int(input())
ab = [list(map(int, input().split())) for _ in range(t)]
for abi in ab:
	if abi[0] == abi[1]:
		print(0)
	elif abi[0] < abi[1]:
		if (abi[1] - abi[0]) % 2 == 1:
			print(1)
		elif (abi[1] - abi[0]) % 2 == 0:
			print(2)
	elif abi[0] > abi[1]:
		if (abi[0] - abi[1]) % 2 == 0:
			print(1)
		elif (abi[0] - abi[1]) % 2 == 1:
			print(2)


for i in range(int(input())):
	(a, b) = input().split()
	n = abs(int(a) - int(b))
	c = n // 10
	if n % 10 != 0:
		c += 1
	print(c)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	d = abs(a - b) + 9
	print(d // 10)


for _ in range(int(input())):
	(a, b) = sorted([int(j) for j in input().split()])
	diff = b - a
	count = int(diff / 10)
	if diff % 10 != 0:
		count += 1
	print(count)


def main():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		cnt = 0
		if a > b:
			cnt = 1 + ((a - b) % 2 != 0)
		elif a < b:
			cnt = 1 + ((b - a) % 2 == 0)
		print(cnt)
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	if a > b:
		print(1 + ((a ^ b) & 1))
	if a < b:
		print(2 - ((a ^ b) & 1))


t = int(input())
l = []
for _ in range(t):
	l.append([int(i) for i in input().split()])

def check(a, b):
	if a == b:
		return 0
	if a < b:
		r = (b - a) % 10
		if r != 0:
			return (b - a) // 10 + 1
		else:
			return (b - a) // 10
	else:
		r = (a - b) % 10
		if r != 0:
			return (a - b) // 10 + 1
		else:
			return (a - b) // 10
for i in range(t):
	print(check(l[i][0], l[i][1]))


t = int(input())
list = []
for i in range(t):
	out = 0
	(a, b) = [int(x) for x in input().split()]
	out += abs(a - b) // 10
	if (a - b) % 10 != 0:
		out += 1
	list.append(out)
for elem in list:
	print(elem)


number = int(input())
result = []

def good(a, b):
	if (a - b) % 10 == 0:
		return int(abs(a - b) / 10)
	else:
		return int(abs(a - b) / 10) + 1
for i in range(number):
	line = input()
	(first, second) = line.split()
	first = int(first)
	second = int(second)
	result.append(good(first, second))
for i in range(number):
	print(result[i])


t = int(input())
while bool(t):
	t -= 1
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	if a < b:
		if (b - a) % 2 != 0:
			print(1)
		else:
			print(2)
	elif (a - b) % 2 == 0:
		print(1)
	else:
		print(2)


import math

def main():
	t = int(input())
	for _ in range(t):
		(a, b) = [int(x) for x in input().split()]
		print(math.ceil(abs(b - a) / 10))
main()


t = int(input())
while t > 0:
	t -= 1
	(m, n) = [int(x) for x in input().split()]
	if m == n:
		print('0')
	elif n > m:
		n -= m
		if n & 1:
			print('1')
		else:
			print('2')
	else:
		m -= n
		if m & 1:
			print('2')
		else:
			print('1')


import sys
t = int(sys.stdin.readline())
for i in range(t):
	(a, b) = map(int, sys.stdin.readline().split())
	diff = abs(a - b)
	c = 0
	for i in range(10, 0, -1):
		c += diff // i
		diff %= i
		if diff == 0:
			break
	sys.stdout.write(str(c) + '\n')


def getAns(a, b):
	return (abs(a - b) + 9) // 10

def main():
	t = int(input())
	anss = [0] * t
	for i in range(t):
		(a, b) = map(int, input().split())
		anss[i] = getAns(a, b)
	for ans in anss:
		print(ans)
main()


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


T = int(input())
for t in range(1, T + 1):
	string = input().split()
	a = int(string[0])
	b = int(string[1])
	answer = abs(b - a) // 10
	if answer * 10 < abs(b - a):
		answer += 1
	print(answer)


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


for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	r = 0
	if abs(b - a) > 10:
		r = abs(b - a)
		if r % 10 == 0:
			print(r // 10)
		else:
			print(r // 10 + 1)
	elif abs(b - a) <= 10 and abs(b - a) > 0:
		print(1)
	else:
		print(0)


from sys import stdin, stdout
import math
for t in range(int(stdin.readline())):
	(a, b) = map(int, stdin.readline().split())
	ans = math.ceil(abs(a - b) / 10)
	print(ans)


import sys
from sys import setrecursionlimit
from collections import defaultdict
setrecursionlimit(10 ** 5)
readline = sys.stdin.readline

def process():
	(a, b) = map(int, readline().strip().split())
	if a == b:
		print(0)
		return
	diff = a - b if a > b else b - a
	if diff % 10 == 0:
		print(diff // 10)
		return
	print(1 + diff // 10)
for _ in range(int(readline())):
	process()


t = int(input())
for i in range(t):
	ip = input().split(' ')
	a = int(ip[0])
	b = int(ip[1])
	diff = abs(a - b)
	if diff % 10 == 0:
		print(int(diff / 10))
	else:
		print(int(diff // 10) + 1)


for _ in range(int(input())):
	(m, n) = map(int, input().split())
	if (max(m, n) - min(m, n)) % 10 == 0:
		print((max(m, n) - min(m, n)) // 10)
	else:
		print((max(m, n) - min(m, n)) // 10 + 1)


import math

def number_of_moves(a, b):
	diff = abs(a - b)
	return math.ceil(diff / 10)
no_lines = int(input())
for i in range(no_lines):
	line = input()
	(a, b) = line.split(' ')
	(a, b) = (int(a), int(b))
	print(number_of_moves(a, b))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	m = abs(b - a)
	ans = m // 10
	if m % 10 == 0:
		print(ans)
	else:
		print(ans + 1)


def ad(d, a):
	if d > 10:
		a = a + 10
	else:
		a = a + d
	return a

def sub(d, a):
	if d > 10:
		a = a - 10
	else:
		a = a - d
	return a

def reduce_diff_lessthanten(a, b):
	d = a - b
	if d > 0:
		m = d // 10
		a = a - m * 10
	else:
		m = abs(d) // 10
		a = a + m * 10
	return [a, m]
t = int(input())
for i in range(t):
	(a, b) = [int(x) for x in input().split()]
	m = 0
	(a, m) = reduce_diff_lessthanten(a, b)
	d = a - b
	while not d == 0:
		if d > 0:
			a = sub(abs(d), a)
			m = m + 1
		else:
			a = ad(abs(d), a)
			m = m + 1
		d = a - b
	print(m)


from fractions import Fraction
from collections import defaultdict
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
t = int(input())
for _ in range(t):
	(a, b) = [int(x) for x in input().split()]
	c = abs(b - a)
	t = 0
	if c % 10 != 0:
		t = 1
	print(c // 10 + t)


t = int(input())
for case in range(t):
	(a, b) = list(map(int, input().split()))
	diff = abs(a - b)
	ten = diff // 10 + int(diff % 10 > 0)
	print(ten)


import math
t = int(input())
i = 0
while i < t:
	ab = list(map(int, input().split()))
	a = ab[0]
	b = ab[1]
	answer = 0
	z = math.ceil(abs(a - b) / 10)
	print(z)
	i += 1


for t in range(int(input())):
	(a, b) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	s = a - b
	ans = 0
	if s % 10:
		ans = 1
	ans += s // 10
	print(ans)


t = int(input())
for i in range(t):
	lst = list(map(int, input().split()))
	t = abs(lst[0] - lst[1])
	if t % 10 != 0:
		print(int(t / 10) + 1)
	else:
		print(int(t / 10))


def twoint(a, b):
	c = abs(a - b)
	co = int(c / 10)
	if c % 10 != 0:
		co = co + 1
	return co
t = int(input(''))
l = []
for i in range(t):
	nk = input('')
	(n, k) = map(int, nk.split())
	c = twoint(n, k)
	l.append(c)
for c in l:
	print(c)


q = int(input(''))
for z in range(0, q):
	a = list(map(int, input().split()))
	l = a[0]
	m = a[1]
	if l > m:
		if (l - m) % 2 == 0:
			print('1')
		else:
			print('2')
	elif m > l:
		if (m - l) % 2 != 0:
			print('1')
		else:
			print('2')
	else:
		print('0')


for _ in range(int(input())):
	(x, y) = [int(x) for x in input().split()]
	print(int((abs(x - y) + 9) / 10))


def solve(a, b):
	if a == b:
		return 0
	c = abs(a - b)
	if c % 10 == 0:
		ans = c // 10
	else:
		ans = 1 + c // 10
	return ans
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	print(solve(a, b))


import sys
pprint = lambda s: print(' '.join(map(lambda x: str(x), s)))
input = lambda : sys.stdin.readline().strip()
ipnut = input
mod = 1000000007
for i in range(int(input())):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	print((d + 9) // 10)


def inp_n():
	return int(input())

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

def inp_mul_num():
	return map(int, input().split())

def is_odd(n):
	if n & 1:
		return True
	return False

def is_prime(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True
from collections import defaultdict
import math
for _ in range(inp_n()):
	(a, b) = inp_mul_num()
	diff = abs(a - b)
	m = 0
	if diff % 10 == 0:
		m = diff // 10
	else:
		m = diff // 10 + 1
	print(m)


n = int(input())
ar = []
for i in range(n):
	s = input()
	a = s.split(' ')
	x = int(a[0])
	y = int(a[1])
	if x == y:
		print(0)
	if x > y and (x - y) % 2 == 1:
		print(2)
	if x > y and (x - y) % 2 == 0:
		print(1)
	if x < y and (y - x) % 2 == 0:
		print(2)
	if x < y and (y - x) % 2 == 1:
		print(1)


total = input()
for i in range(int(total)):
	(a, b) = input().strip().split()
	a = int(a)
	b = int(b)
	if a == b:
		print('0')
	else:
		tmp = b - a
		if tmp > 0:
			if tmp % 2 == 0:
				print('2')
			else:
				print('1')
		elif tmp % 2 == 0:
			print('1')
		else:
			print('2')


import math
for _ in range(int(input())):
	(x, y) = input().split()
	print(math.ceil(abs(int(x) - int(y)) / 10))


def solution(a, b):
	return abs(a - b) // 10 + bool(abs(a - b) % 10)
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split(' '))
	print(solution(a, b))


t = int(input())
(a, b) = (0, 0)
for i in range(t):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	number = 10
	count = 0
	difference = b - a
	while difference != 0:
		if difference // number != 0:
			c = difference // number
			count += c
			difference -= c * number
		number -= 1
	print(count)


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


import math
n = int(input())
for _ in range(n):
	a = list(map(int, input().split()))
	ans = 0
	c = abs(a[1] - a[0]) / 10
	ans = math.ceil(c)
	print(ans)


import math
for test in range(int(input())):
	(a, b) = map(int, input().split())
	if b >= a:
		print(int(math.ceil((b - a) / 10)))
	else:
		print(int(math.ceil((a - b) / 10)))


import math
import sys

class Graph:

	def __init__(self, Nodes, is_directed=False):
		self.nodes = Nodes
		self.adj_list = {}
		self.is_directed = is_directed
		for node in self.nodes:
			self.adj_list[node] = []

	def add_edge(self, u, v):
		if v not in self.adj_list[u]:
			self.adj_list[u].append(v)
		if self.is_directed == False:
			if u not in self.adj_list[v]:
				self.adj_list[v].append(u)

	def print_graph(self):
		for node in self.nodes:
			print(node, '->', self.adj_list[node])

	def degree_node(self, node):
		return len(self.adj_list[node])

	def dfsUTIL(self, v, visited, parents=[]):
		parents.append(v)
		visited[v] = True
		for i in self.adj_list[v]:
			if visited[i] == False:
				self.dfsUTIL(i, visited, parents)

	def dfs(self, v):
		visited = [False] * (max(self.adj_list) + 5)
		parents = []
		self.dfsUTIL(v, visited, parents)
		return parents

def dict_sort(ans):
	ans = sorted(ans.items(), reverse=True, key=lambda kv: kv[1])

def is_prime(n):
	if n == 1:
		return 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def seive_primes(n):
	flag = [0] * (n + 10)
	flag[1] = flag[0] = 1
	i = 2
	while i * i <= n + 1:
		if flag[i] == 0:
			j = i * i
			while j <= n + 1:
				flag[j] = 1
				j += i
		i += 1
	return flag

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

def lcm(a, b):
	return a * b // gcd(a, b)

def alphabates():
	return 'abcdefghijklmnopqrstuvwxyz'

def binary_search(ls, n, flag):
	low = 0
	hi = n - 1
	while low <= hi:
		mid = (low + hi) // 2
		if ls[mid] == flag:
			return mid
		elif ls[mid] > flag:
			hi = mid - 1
		else:
			low = mid + 1
	return -1

def qdrt(x, a, b, c):
	return a * x * x + b * x + c

def inp():
	ls = list(map(int, input().split()))
	return ls

def mult_inp():
	return map(int, input().split())
for _ in range(int(input())):
	(a, b) = mult_inp()
	dif = abs(b - a)
	print(math.ceil(dif / 10))


t = int(input())
for iii in range(t):
	(a, b) = 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())
ans = []
for _ in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	(x, y) = divmod(b - a, 10)
	if y != 0:
		y = 1
	else:
		y = 0
	ans.append(x + y)
print(*ans, sep='\n')


n = int(input())
for q in range(n):
	inp = input()
	lis = list((int(i) for i in inp.split()))
	a = lis[0]
	b = lis[1]
	if a >= b:
		dif = a - b
	else:
		dif = b - a
	if dif % 10 == 0:
		dif = dif
	else:
		dif = dif + (10 - dif % 10)
	print(dif // 10)


for u in range(int(input())):
	(x, y) = map(int, input().split())
	s = abs(x - y)
	if s % 10 == 0:
		print(s // 10)
	else:
		print(s // 10 + 1)


from math import ceil

def read_int() -> int:
	return int(input())

def read_ints():
	return map(int, input().split(' '))

def test_case():
	(a, b) = sorted(read_ints())
	print(ceil((b - a) / 10))
for _ in range(read_int()):
	test_case()


for t in range(int(input())):
	(n, m) = list(map(int, input().split()))
	diff = abs(n - m)
	print(diff // 10 + int(bool(diff % 10)))


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


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	t = I()
	rr = []
	for _ in range(t):
		(a, b) = LI()
		r = 0
		if a == b:
			r = 0
		elif a % 2 == b % 2:
			if a >= b:
				r = 1
			else:
				r = 2
		elif a < b:
			r = 1
		else:
			r = 2
		rr.append(r)
	return JA(rr, '\n')
print(main())


def func(a, b):
	rem = abs(a - b)
	if rem % 10 == 0:
		return rem // 10
	return rem // 10 + 1
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	print(func(a, b))


for _ in range(int(input())):
	s = [int(x) for x in input().split()]
	s.sort()
	div = (s[1] - s[0]) / 10
	if div > int(div):
		print(int(div) + 1)
	else:
		print(int(div))


t = input()
t = int(t)
for i in range(t):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	moves = diff // 10 + int(diff % 10 > 0)
	print(moves)


t = int(input())
for _ipj_ in range(t):
	(a, b) = map(int, input().split())
	tmp = abs(a - b)
	ans = tmp // 10
	if tmp % 10:
		ans += 1
	print(ans)


def check(a, b):
	if a == b:
		return 0
	else:
		t = abs(a - b)
		if t % 10 == 0:
			return t // 10
		else:
			return t // 10 + 1
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(check(a, b))


from functools import reduce
import collections
import math
import sys

class Read:

	@staticmethod
	def string():
		return input()

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

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

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

def main():
	t = Read.int()
	for _ in range(t):
		(a, b) = Read.list_int()
		if a == b:
			print(0)
		elif a > b:
			if (a - b) % 10 == 0:
				print((a - b) // 10)
			else:
				print((a - b) // 10 + 1)
		elif (b - a) % 10 == 0:
			print((b - a) // 10)
		else:
			print((b - a) // 10 + 1)
main()


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


import math
tc = int(input())
while tc > 0:
	tc -= 1
	(a, b) = map(int, input().split())
	print(int(math.ceil(abs(a - b) / 10)))


import math
for _ in range(int(input())):
	number = list(map(int, input().split()))
	a = number[0]
	b = number[1]
	ans = math.ceil(abs(a - b) / 10)
	print(ans)


def equal(a, b):
	count = 0
	if a > b:
		c = (a - b) // 10
		if (a - b) % 10 != 0:
			count += 1 + c
		else:
			count += c
	elif b > a:
		c = (b - a) // 10
		if (b - a) % 10 != 0:
			count += 1 + c
		else:
			count += c
	return count
n = int(input())
for i in range(n):
	(x, y) = input().split()
	print(equal(int(x), int(y)))


def main():
	for _ in range(int(input())):
		(a, b) = [int(i) for i in input().split()]
		n = abs(a - b)
		res = n // 10
		if n % 10 != 0:
			res += 1
		print(res)
main()


def saurabh(a, b):
	if a == b:
		return 0
	x = abs(a - b)
	q = x // 10
	if x == q * 10:
		return q
	return q + 1
for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	print(saurabh(a, b))


import sys
import math
from os import path
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	print((abs(a - b) + 9) // 10)


def algo(a, b):
	d = abs(a - b)
	n = 0
	k = 10
	while d > 0:
		n += d // k
		d = d % k
		k -= 1
	return n
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ans = algo(a, b)
	print(ans)


import math

def moves(ab):
	return math.ceil(abs(ab[0] - ab[1]) / 10)
ar = []
count = int(input())
for _ in range(count):
	ar.append(list(map(int, input().split())))
for i in ar:
	print(moves(i))


t = int(input())
while t:
	(a, b) = tuple(map(int, input().split()))
	dif = abs(a - b)
	step = 10
	ans = 0
	while dif:
		ans += int(dif // step)
		dif = dif % step
		step -= 1
	print(ans)
	t -= 1


import math, queue, heapq
import sys
sys.setrecursionlimit(10 ** 6)
fastinput = sys.stdin.readline
fastout = sys.stdout.write
t = int(fastinput())
while t:
	t -= 1
	(a, b) = map(int, fastinput().split())
	x = abs(a - b)
	print(x // 10 + (0 if x % 10 == 0 else 1))


import sys
input = lambda : sys.stdin.readline().rstrip()
from math import ceil
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ans = abs(b - a)
	print(ceil(ans / 10))


from sys import stdin

def solve(a, b):
	ans = 0
	while a != b:
		if b > a:
			if (b - a) % 2 != 0:
				a = a + (b - a)
			else:
				a = b + 2
		elif (a - b) % 2 == 0:
			a = a - (a - b)
		else:
			a = b - 1
		ans += 1
	return ans

def main():
	t = int(stdin.readline().strip())
	for _ in range(t):
		(a, b) = map(int, stdin.readline().strip().split())
		print(solve(a, b))
main()


t = int(input())
ans = []
for i in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		ans.append(0)
		continue
	if a > b:
		if (a - b) % 2 == 0:
			ans.append(1)
			continue
		else:
			ans.append(2)
			continue
	elif (b - a) % 2 == 0:
		ans.append(2)
		continue
	else:
		ans.append(1)
		continue
print(*ans, sep='\n')


t = int(input())
arr = []
for i in range(t):
	(a, b) = map(int, input().split())
	arr.append((a, b))
for i in range(t):
	print((abs(arr[i][1] - arr[i][0]) - 1) // 10 + 1)


def main():
	t = int(input())
	for _ in range(t):
		(a, b) = (int(x) for x in input().split())
		print(solver(a, b))

def solver(a, b):
	if a == b:
		return 0
	elif a < b:
		if (b - a) % 2 == 0:
			return 2
		else:
			return 1
	elif (a - b) % 2 == 0:
		return 1
	else:
		return 2
main()


t = int(input())
k = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		x = max(a, b)
		y = min(a, b)
		diff = x - y
		ctr = 0
		for i in range(len(k) - 1, 0, -1):
			a = diff // k[i]
			ctr += a
			diff -= a * k[i]
		print(ctr)


def solve(a, b):
	diff = abs(a - b)
	rem = diff % 10
	diff //= 10
	if rem > 0:
		ans = diff + 1
	else:
		ans = diff
	print(ans)
n = int(input())
for i in range(n):
	l = list(map(int, input().split()))
	solve(l[0], l[1])


for TC in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	c = (a - b) // 10
	print(c if not (a - b) % 10 else c + 1)


import sys, math
wtf = sys.stdin.read()
wtf = wtf.strip().split('\n')
t = int(wtf[0])
assert t >= 1 and t <= int(200000.0) and (t == len(wtf[1:])), 'Precondition failure'
for w in wtf[1:]:
	(a, b) = map(int, w.split(' '))
	c = abs(a - b)
	print(c // 10 + (1 if c % 10 > 0 else 0))


out = list()
k = int(input())
for i in range(0, k):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if a == b:
		out.append(0)
	if a > b:
		if (a - b) % 10 == 0:
			out.append((a - b) // 10)
		else:
			out.append((a - b) // 10 + 1)
	if a < b:
		if (b - a) % 10 == 0:
			out.append((b - a) // 10)
		else:
			out.append((b - a) // 10 + 1)
for i in out:
	print(i)


import math
from math import sqrt
import sys
from functools import reduce
from collections import defaultdict

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

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def modInverse(a, m):
	g = gcd(a, m)
	if g != 1:
		return 0
	else:
		return power(a, m - 2, m)

def power(x, y, m):
	if y == 0:
		return 1
	p = power(x, y // 2, m) % m
	p = p * p % m
	if y % 2 == 0:
		return p
	else:
		return x * p % m

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

def solve_final(g, suitable, n):
	comb = 0
	distance = defaultdict(dict)
	for i in range(1, n + 1):
		if suitable[i] == 0:
			continue
		visited = [False] * (n + 1)
		queue = [i]
		visited[i] = True
		k = 1
		while len(queue) != 0:
			distance[i][k] = []
			temp = []
			for _ in range(len(queue)):
				node = queue.pop(0)
				for nd in g[node]:
					if not visited[nd]:
						temp.append(nd)
						if suitable[nd] == 1:
							distance[i][k].append(nd)
						visited[nd] = True
			k += 1
			queue = temp
	print(distance)
	for i in range(1, n + 1):
		for dist in distance[i]:
			for nd1 in distance[i][dist]:
				for nd2 in distance[nd1][dist]:
					if nd2 in distance[i][dist]:
						print(i, nd1, nd2)
						comb += 1
	return comb

def solve(a, b):
	if a == b:
		return 0
	if b > a:
		if a % 2 and b % 2:
			return 2
		elif a % 2 or b % 2:
			return 1
		else:
			return 2
	elif a % 2 and b % 2:
		return 1
	elif a % 2 or b % 2:
		return 2
	else:
		return 1
for _ in range(iinput()):
	(a, b) = rinput()
	print(solve(a, b))


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


t = int(input())
for _ in range(t):
	(n1, n2) = list(map(int, input().rstrip().split()))
	if n1 == n2:
		print(0)
	else:
		diff = max(n1, n2) - min(n1, n2)
		choice = 0
		for i in range(10, 0, -1):
			if diff // i > 0:
				choice = i
				break
		if diff % choice == 0:
			print(diff // choice)
		else:
			print(diff // choice + 1)


for _ in range(int(input())):
	l = [int(c) for c in input().split()]
	a = l[0]
	b = l[1]
	n = abs(a - b) / 10
	if n - int(n) > 0:
		n += 1
	n = int(n)
	print(n)


t = int(input())
res = ''
for _t in range(t):
	(a, b) = list(map(int, input().split()))
	if b > a:
		(a, b) = (b, a)
	moves = 0
	if a != b:
		x = int((a - b) / 10)
		if a - x * 10 == b:
			moves = x
		else:
			moves = x + 1
	res += str(moves) + '\n'
print(res)


import math
t = int(input())
for z in range(t):
	(a, b) = map(int, input().split())
	print(math.ceil(abs(b - a) / 10))


x = int(input())
p = []
for i in range(x):
	(a, b) = map(int, input().split())
	g = (abs(a - b) + 9) // 10
	p.append(g)
print(*p, sep='\n')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b) = (int(i) for i in input().split())
	if a > b:
		(a, b) = (b, a)
	res = (b - a) // 10 + (1 if (b - a) % 10 else 0)
	print(res)


for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	ans = 0
	if b > a:
		ans = 2
		if (b - a) % 2:
			ans = 1
	if b < a:
		ans = 1
		if (a - b) % 2:
			ans = 2
	print(ans)


def solve(a, b):
	moves = 0
	get = 0
	if a == b:
		return 0
	elif a < b:
		get = b - a
		moves = moves + 1
		if get % 2 == 0:
			moves = moves + 1
	elif a > b:
		get = a - b
		moves = moves + 1
		if get % 2 != 0:
			moves = moves + 1
	return moves
T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	print(solve(a, b))


t = int(input())
for t_qtr in range(t):
	nk = input().split()
	n = int(nk[0])
	k = int(nk[1])
	a = k - n
	a = abs(a)
	if a == 0:
		print(0)
	elif a % 10 == 0:
		print(int(a / 10))
	else:
		c = a // 10
		c = c + 1
		print(int(c))


num = int(input())
a = [0] * num
b = [0] * num
for i in range(num):
	(a[i], b[i]) = map(int, input().split())
	dif = a[i] - b[i]
	if dif < 0:
		if dif % 2 != 0:
			print('1')
		else:
			print('2')
	elif dif > 0:
		if dif % 2 != 0:
			print('2')
		else:
			print('1')
	else:
		print('0')


z = int(input())
for i in range(z):
	(q, w) = map(int, input().split(' '))
	if q == w:
		print('0')
	elif q < w:
		if abs(w - q) % 2 == 1:
			print('1')
		else:
			print('2')
	elif abs(q - w) % 2 == 0:
		print('1')
	else:
		print('2')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ans = 0
	if a == b:
		print(0)
	else:
		if a > b:
			a1 = a - b
		else:
			a1 = b - a
		while a1 > 0:
			if a1 >= 10:
				ans += a1 // 10
				if a1 % 10 == 0:
					print(ans)
					break
				else:
					a1 = a1 - a1 // 10 * 10
			elif a1 >= 9:
				ans += a1 // 9
				if a1 % 9 == 0:
					print(ans)
					break
				else:
					a1 = a1 - a1 // 9 * 9
			elif a1 >= 8:
				ans += a1 // 8
				if a1 % 8 == 0:
					print(ans)
					break
				else:
					a1 = a1 - a1 // 8 * 8
			elif a1 >= 7:
				ans += a1 // 7
				if a1 % 7 == 0:
					print(ans)
					break
				else:
					a1 = a1 - a1 // 7 * 7
			elif a1 >= 6:
				ans += a1 // 6
				if a1 % 6 == 0:
					print(ans)
					break
				else:
					a1 = a1 - a1 // 6 * 6
			elif a1 >= 5:
				ans += a1 // 5
				if a1 % 5 == 0:
					print(ans)
					break
				else:
					a1 = a1 - a1 // 5 * 5
			elif a1 >= 4:
				ans += a1 // 4
				if a1 % 4 == 0:
					print(ans)
					break
				else:
					a1 = a1 - a1 // 4 * 4
			elif a1 >= 3:
				ans += a1 // 3
				if a1 % 3 == 0:
					print(ans)
					break
				else:
					a1 = a1 - a1 // 3 * 3
			elif a1 >= 2:
				ans += a1 // 2
				if a1 % 2 == 0:
					print(ans)
					break
				else:
					a1 = a1 - a1 // 2 * 2
			elif a1 >= 1:
				ans = ans + 1
				print(ans)
				break


def abs(n):
	return -n if n < 0 else n
tc = int(input())
for t in range(tc):
	(a, b) = [int(i) for i in input().split(' ')]
	if a == b:
		print('0')
	else:
		r = abs(a - b) // 10
		r += 1 if abs(a - b) % 10 != 0 else 0
		print(r)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split(' ')))
	if a == b:
		print(0)
	elif a > b:
		val = a - b
		if val % 10 == 0:
			print(val // 10)
		else:
			print(val // 10 + 1)
	else:
		va = b - a
		if va % 10 == 0:
			print(va // 10)
		else:
			print(va // 10 + 1)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def print_list(l):
	print(' '.join(map(str, l)))
from math import ceil, floor, sqrt, pow
n = int(input())
for _ in range(n):
	(a, b) = map(int, sys.stdin.readline().rstrip().split())
	print(ceil(abs(a - b) / 10))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	z = abs(a - b)
	(x, y) = divmod(z, 10)
	if y >= 1:
		print(x + 1)
	else:
		print(x)


t = int(input())
answer = []
while t > 0:
	(a, b) = list(map(int, input().split()))
	ans = (abs(a - b) + 9) // 10
	answer.append(ans)
	t -= 1
for i in answer:
	print(i)


t = int(input())
K = []
for i in range(t):
	(a, b) = list(map(int, input().split()))
	k = 0
	if a != b:
		if a > b and (a - b) % 2 == 0 or (a < b and (b - a) % 2 == 1):
			k = 1
		else:
			k = 2
	K.append(k)
for i in range(t):
	print(K[i])


import math
t = int(input())
while t > 0:
	k = input()
	a = int(k.split(' ')[0])
	b = int(k.split(' ')[1])
	out = abs(a - b) / 10
	if abs(a - b) % 10 != 0:
		out = out + 1
	print(int(out))
	t = t - 1


a = int(input())
for _ in range(a):
	(b, c) = map(int, input().split())
	e = max(c, b)
	f = e + e - c - b
	g = f + 9
	h = g // 10
	print(h)


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


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(x, y):
	return f(x) // (f(y) * f(x - y))
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	z = b - a
	if a == b:
		print(0)
	elif b > a:
		if (b - a) % 2 == 0:
			print(2)
		else:
			print(1)
	elif abs(b - a) % 2 == 0:
		print(1)
	else:
		print(2)


T = int(input())
for t in range(T):
	ab = list(map(int, input().split()))
	a = ab[0]
	b = ab[1]
	c = 0
	if a < b:
		while a != b:
			if b - a <= 10:
				c += 1
				a = b
			else:
				t = (b - a) // 10
				a += t * 10
				c += t
	else:
		while a != b:
			if a - b <= 10:
				c += 1
				a = b
			else:
				t = (a - b) // 10
				a -= t * 10
				c += t
	print(c)


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	if a == b:
		print(c)
	else:
		k = c // 10
		if c % 10 == 0:
			print(math.floor(k))
		else:
			print(math.floor(k) + 1)


t = int(input())
for T in range(t):
	(a, b) = map(int, input().split())
	raz = abs(a - b)
	print((raz + 9) // 10)


import sys, math
input = sys.stdin.readline
t = int(input())
for r in range(t):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	if x % 10 == 0:
		print(x // 10)
	else:
		print(x // 10 + 1)


T = int(input())
while T:
	T -= 1
	(a, b) = [int(i) for i in input().split()]
	print(str(-(-abs(a - b) // 10)))


import sys
from collections import defaultdict
from itertools import permutations, combinations
import string
from heapq import heapify, heappush, heappop

def solve():
	alphabets = string.ascii_lowercase
	digits = string.digits
	get_arr = lambda type_=int: list(map(type_, sys.stdin.readline().rstrip('\n').split()))
	inp = lambda type_=int: type_(sys.stdin.readline().rstrip('\n'))
	pair = lambda type_=int: map(type_, sys.stdin.readline().rstrip('\n').split(' '))
	t = inp()
	for _ in range(t):
		(a, b) = pair()
		if a == b:
			res = 0
		elif a > b:
			if a % 2 == 0:
				if b % 2 == 0:
					res = 1
				else:
					res = 2
			elif a % 2 != 0:
				if b % 2 == 0:
					res = 2
				else:
					res = 1
		elif a % 2 == 0:
			if b % 2 == 0:
				res = 2
			else:
				res = 1
		elif a % 2 != 0:
			if b % 2 == 0:
				res = 1
			else:
				res = 2
		print(res)
solve()


def func(a, b):
	if a < b:
		n = b - a
		if n % 2 != 0:
			return 1
		else:
			return 2
	elif a == b:
		return 0
	else:
		n = a - b
		if n % 2 == 0:
			return 1
		else:
			return 2
t = int(input())
for _ in range(t):
	s = list(map(int, input().split()))
	(a, b) = (s[0], s[1])
	print(func(a, b))


t = int(input())
i = 0
while i < t:
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	v = abs(a - b)
	if v % 10 == 0:
		print(v // 10)
	else:
		print(v // 10 + 1)
	i += 1


def new(arr):
	if arr[0] == arr[1]:
		return 0
	elif arr[0] < arr[1]:
		diff = arr[1] - arr[0]
		if diff % 2 != 0:
			return 1
		else:
			return 2
	elif arr[0] > arr[1]:
		diff = arr[0] - arr[1]
		if diff % 2 == 0:
			return 1
		else:
			return 2
t = int(input())
for i in range(t):
	arr = list(map(int, input().split()))
	print(new(arr))


import sys
input = sys.stdin.readline
read = lambda : map(int, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

def lcm(a, b):
	return a * b // gcd(a, b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

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

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left

def solve():
	(a, b) = read()
	print(math.ceil(abs(a - b) / 10))
for _ in range(int(input())):
	solve()


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
stdarr = lambda : map(int, stdstr().split())
mod = 1000000007
for _ in range(stdint()):
	(a, b) = stdarr()
	if a == b:
		print(0)
		continue
	if a > b:
		if (a - b) % 2 == 0:
			print(1)
		else:
			print(2)
	elif (b - a) % 2 == 1:
		print(1)
	else:
		print(2)


outputs = []
for i in range(int(input())):
	inputs = input().split(' ')
	for i in range(len(inputs)):
		inputs[i] = int(inputs[i])
	a = inputs[0]
	b = inputs[1]
	if a == b:
		outputs.append(0)
	elif a > b:
		if (a - b) % 2 == 0:
			outputs.append(1)
		else:
			outputs.append(2)
	elif (b - a) % 2 == 0:
		outputs.append(2)
	else:
		outputs.append(1)
for i in range(len(outputs)):
	print(outputs[i])


t = int(input())
while t != 0:
	(a, b) = map(int, input().split())
	temp = abs(a - b)
	k = 10
	count = 0
	while temp != 0:
		count += temp // k
		temp = temp % k
		k -= 1
	print(count)
	t -= 1


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	x = abs(b - a)
	ans = x // 10
	if x % 10:
		ans += 1
	print(ans)


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


times = int(input())
ctr = 0
while ctr < times:
	nums = input().split(' ')
	number = [int(x) for x in nums]
	a = number[0]
	b = number[1]
	ans = abs(a - b) / 10
	if abs(a - b) % 10 != 0:
		ans += 1
	print(int(ans))
	ctr += 1


tests = int(input())
while tests > 0:
	(a, b) = [int(i) for i in input().split(' ')]
	if a == b:
		print(0)
	elif a < b:
		if (b - a) % 2 == 0:
			print(2)
		else:
			print(1)
	elif (a - b) % 2 == 1:
		print(2)
	else:
		print(1)
	tests = tests - 1


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	print((abs(a - b) + 10 - 1) // 10)


n = int(input())
for i in range(n):
	nums = list(map(int, input().split(' ')))
	a = nums[0]
	b = nums[1]
	res = abs(a - b) // 10
	if (a - b) % 10 != 0:
		res += 1
	print(res)


def solve(a, b):
	diff = abs(b - a)
	(n, r) = divmod(diff, 10)
	return n + 1 if r > 0 else n
n = int(input())
for i in range(n):
	(a, b) = [int(x) for x in input().split(' ')]
	print(solve(a, b))


def get_strings():
	str_list = []
	first_str = input()
	for i in range(int(first_str)):
		q = input()
		str_list.append(q)
	return str_list

def calculate_2(a, b):
	c = a - b
	k = 10
	count = 0
	if c > k:
		count = c / k
		if c % k == 0:
			return c // k
		else:
			return c // k + 1
	else:
		return 1

def calculate(str):
	int_str = str.split(' ')
	a = int(int_str[0])
	b = int(int_str[1])
	if a - b == 0:
		return 0
	if a > b:
		return calculate_2(a, b)
	else:
		return calculate_2(b, a)
list_strings = get_strings()
list_output = []
for i in list_strings:
	end_calc = calculate(i)
	list_output.append(end_calc)
	print(end_calc)


import math
t = int(input())
for q in range(0, t):
	(n, m) = map(int, input().split())
	m1 = min(n, m)
	m2 = max(n, m)
	ans = math.ceil((m2 - m1) / 10)
	print(ans)


for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	diff = abs(a - b)
	cnt = 0
	for i in range(10, 0, -1):
		cnt += diff // i
		if diff % i == 0:
			print(cnt)
			break
		else:
			diff = diff % i


def pro(a, b):
	n = abs(a - b)
	ans = n // 10
	n = n % 10
	if n == 0:
		return ans
	return ans + 1
t = int(input())
for i in range(t):
	arr = list(map(int, input().split()))
	(a, b) = (arr[0], arr[1])
	print(pro(a, b))


def run_case():
	(a, b) = map(int, input().split())
	temp = abs(b - a)
	if temp % 10 == 0:
		print(temp // 10)
	else:
		print(temp // 10 + 1)
flag = 1
if flag:
	t = int(input())
	for i in range(t):
		run_case()
else:
	run_case()


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	t = int(input())
	for i in range(t):
		(a, b) = map(int, input().split())
		print((abs(b - a) + 9) // 10)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for s in [*open(0)][1:]:
	(a, b) = map(int, s.split())
	if (a - b) % 10 == 0:
		x = abs(b - a) / 10
	else:
		x = abs(b - a) / 10 + 1
	print(int(x))


t = int(input())
cases = []
while t > 0:
	cases.append([int(x) for x in input().split(' ')])
	t -= 1
for case in cases:
	moves = 0
	if case[0] == case[1]:
		print(moves)
		continue
	else:
		df = abs(case[0] - case[1])
		i = 10
		while i > 0:
			if df // i:
				moves += df // i
				df -= df // i * i
			i -= 1
		print(moves)


import sys
import bisect

def ri():
	return int(input())

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


import sys
t = int(sys.stdin.readline())
for num in range(t):
	(a, b) = map(int, sys.stdin.readline().split())
	if a >= b:
		dif = a - b
	else:
		dif = b - a
	if dif % 10 == 0:
		print(dif // 10)
	else:
		print(dif // 10 + 1)


n = int(input())
while n != 0:
	(a, b) = map(int, input().split())
	m = abs(a - b)
	if m % 10 != 0:
		c = int(m / 10) + 1
	elif m % 10 == 0:
		c = int(m / 10)
	print(c)
	n -= 1


no = int(input())
main = []
for i in range(no):
	(a, b) = map(int, input().split())
	sub = a - b
	if sub == 0:
		main.append(0)
	elif sub % 2 != 0:
		if sub < 0:
			main.append(1)
		else:
			main.append(2)
	elif sub < 0:
		main.append(2)
	else:
		main.append(1)
for i in main:
	print(i)


import math
t = int(input())
for i in range(t):
	inputs = list(map(int, input().split()))
	(a, b) = (inputs[0], inputs[1])
	r = math.ceil(abs(b - a) / 10)
	print(r)


import math
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	n = d // 10
	if d % 10 != 0:
		n = n + 1
	print(n)


import sys

def get_ints():
	return map(int, I().split())

def get_list():
	return list(map(int, I().split()))

def I():
	return sys.stdin.readline()
t = int(I())
for k in range(t):
	(a, b) = get_ints()
	c = abs(a - b)
	if c == 0:
		print(0)
	elif c <= 10:
		print(1)
	elif c > 10 and c % 10 == 0:
		print(c // 10)
	else:
		print(c // 10 + 1)


t = int(input())
while t:
	t -= 1
	(a_, b_) = input().split(' ')
	a = int(a_)
	b = int(b_)
	absab = abs(a - b)
	ans = 0
	ans = absab // 10
	if absab % 10:
		ans += 1
	print(ans)


import math
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	r = abs(a - b)
	if r == 0:
		print(0)
	elif r <= 10:
		print(1)
	else:
		ans = math.floor(r / 10)
		if r % 10 == 0:
			print(ans)
		else:
			print(ans + 1)


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


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	difference = abs(a - b)
	(d, m) = divmod(difference, 10)
	if m > 0:
		d += 1
	print(d)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	print('%d' % int((max(a, b) - min(a, b) + 9) // 10))


t = int(input())
fin = []
for i in range(t):
	a = list(map(int, input().split()))
	fin.append(a)
for j in fin:
	a = j[0]
	b = j[1]
	if a == b:
		print(0)
	elif a > b:
		if (a - b) % 10 == 0:
			print((a - b) // 10)
		else:
			print((a - b) // 10 + 1)
	elif (b - a) % 10 == 0:
		print((b - a) // 10)
	else:
		print((b - a) // 10 + 1)


import math

def find_ans(a, b):
	n = abs(a - b)
	print(math.ceil(n / 10))
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	find_ans(a, b)


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if abs(a - b) % 10 != 0:
		if a > b:
			print(math.ceil((a - b) // 10) + 1)
		elif a == b:
			print(0)
		else:
			print(math.ceil((b - a) // 10) + 1)
	elif a > b:
		print(math.ceil((a - b) // 10))
	elif a == b:
		print(0)
	else:
		print(math.ceil((b - a) // 10))


t = int(input())
while t:
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	count = diff // 10
	rem = diff % 10
	if rem != 0:
		count += 1
	print(count)
	t -= 1


def reminder(i: int):
	return i % 2

def calc(a: int, b: int):
	if a == b:
		return 0
	if a < b:
		if reminder(a) == 0 and reminder(b) == 0:
			return 2
		elif reminder(a) == 1 and reminder(b) == 1:
			return 2
		elif reminder(a) == 0 and reminder(b) == 1:
			return 1
		elif reminder(a) == 1 and reminder(b) == 0:
			return 1
	elif a > b:
		if reminder(a) == 0 and reminder(b) == 0:
			return 1
		elif reminder(a) == 1 and reminder(b) == 1:
			return 1
		elif reminder(a) == 0 and reminder(b) == 1:
			return 2
		elif reminder(a) == 1 and reminder(b) == 0:
			return 2

def main():
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		print(calc(a, b))
main()


x = int(input())
t = []
for c in range(x):
	t.append(input().split())
for c in t:
	if c[0] == c[1]:
		print('0')
	if int(c[0]) < int(c[1]):
		if (int(c[0]) - int(c[1])) % 2 == 0:
			print('2')
		else:
			print('1')
	if int(c[0]) > int(c[1]):
		if (int(c[0]) - int(c[1])) % 2 == 0:
			print('1')
		else:
			print('2')


def solve(a, b):
	if a == b:
		return 0
	d = abs(a - b)
	if a < b:
		if d % 2:
			return 1
		else:
			return 2
	elif d % 2:
		return 2
	else:
		return 1
N = int(input())
for _ in range(N):
	(a, b) = map(int, input().split())
	print(solve(a, b))


a = int(input())
i = 1
while i <= a:
	b = [int(x) for x in input().split()]
	c = max(b[0], b[1])
	d = min(b[0], b[1])
	e = c - d
	e = e / 10
	if e % 1 == 0:
		print(int(e))
	else:
		print(int(e) + 1)
	i += 1


import sys
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a > b and (a - b) % 2 == 0:
		print(1)
	elif a > b and (a - b) % 2 == 1:
		print(2)
	elif a < b and (b - a) % 2 == 0:
		print(2)
	elif a < b and (b - a) % 2 == 1:
		print(1)


import sys, os.path, math
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
sys.setrecursionlimit(10 ** 5)

def ii():
	return int(sys.stdin.readline())

def mi():
	return map(int, sys.stdin.readline().split())

def li():
	return list(map(int, sys.stdin.readline().split()))
print = sys.stdout.write

def solve():
	(a, b) = mi()
	print(str(math.ceil(abs(a - b) / 10)) + '\n')
for _ in range(ii()):
	solve()


import sys, collections
input = sys.stdin.readline
n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	if a < b:
		(a, b) = (b, a)
	x = a % 10
	y = b % 10
	ans = 0
	if x > y:
		ans += 1
	a += -x
	b += -y
	z = a - b
	z //= 10
	ans += z
	print(ans)


for x in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		c = abs(a - b) // 10
		d = abs(a - b) % 10
		if d != 0:
			c += 1
		print(c)


import math
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	p = abs(x - y)
	if p % 10 == 0:
		print(p // 10)
	else:
		print(p // 10 + 1)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	sub = abs(a - b)
	total = sub // 10
	if sub % 10 < 10 and sub % 10 != 0:
		total += 1
	print(total)


import math
import sys
from collections import deque
import heapq

def inp():
	return sys.stdin.readline().rstrip()

def mpp():
	return map(int, inp().split())

def lis():
	return list(mpp())

def sol(a, b):
	if a == b:
		return 0
	if a < b:
		temp = (b - a) % 10
		return (b - a) // 10 + 1 if temp != 0 else (b - a) // 10
	else:
		temp = (a - b) % 10
		return (a - b) // 10 + 1 if temp != 0 else (a - b) // 10

def main():
	t = int(inp())
	for _ in range(t):
		(a, b) = mpp()
		print(sol(a, b))
main()


def check():
	if False:
		print('hello')

def solve():
	t = int(input())
	for i in range(t):
		(aa, bb) = list(map(int, input().split()))
		if abs(aa - bb) % 10 == 0:
			print(abs(aa - bb) // 10)
		else:
			print(abs(aa - bb) // 10 + 1)
check()
solve()


test_cases = int(input())
test = test_cases
data = []
while test_cases > 0:
	data.append(input().split())
	test_cases -= 1
for i in range(0, test):
	if int(data[i][0]) > int(data[i][1]):
		if (int(data[i][0]) - int(data[i][1])) % 2 == 0:
			print(1)
		else:
			print(2)
	elif int(data[i][0]) < int(data[i][1]):
		if (int(data[i][0]) - int(data[i][1])) % 2 == 1:
			print(1)
		else:
			print(2)
	else:
		print(0)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a < b and a + 10 >= b or (a > b and a - 10 <= b):
		print(1)
	else:
		razn = abs(a - b) / 10
		if int(razn) - razn != 0:
			razn = int(razn) + 1
		print(int(razn))


import math
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if math.fabs(b - a) % 10 == 0:
		print(int(math.fabs(a - b) // 10))
	else:
		print(int(math.fabs(a - b) // 10 + 1))


inp = int(input())
for i in range(inp):
	pairs = list(map(int, input().split()))
	d = pairs[0] - pairs[1]
	if d < 0 and d % 2 == 1:
		print(1)
	elif d > 0 and d % 2 == 0:
		print(1)
	elif pairs[0] == pairs[1]:
		print(0)
	else:
		print(2)


import sys
from math import ceil
put = sys.stdin.readline
t = int(put())
while t:
	t -= 1
	(a, b) = map(int, put().split())
	print(ceil(abs(a - b) / 10))


t = int(input(''))
for i in range(t):
	(a, b) = map(int, input('').split())
	sub = abs(a - b)
	if sub > 10:
		s = sub // 10
		if sub % 10 != 0:
			total = s + 1
			print(total)
		else:
			print(s)
	elif sub == 0:
		print('0')
	else:
		print('1')


for _ in range(int(input())):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	minInt = min(a, b)
	maxInt = max(a, b)
	diff = maxInt - minInt
	if diff % 10 == 0:
		print(int(diff / 10))
	else:
		print(int(diff / 10 + 1))


cases = int(input())
for i in range(cases):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		x = max(a, b)
		y = min(a, b)
		chances = 0
		chances += (x - y) // 10
		if (x - y) % 10 != 0:
			chances += 1
		print(chances)


for iii in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	dif = abs(b - a)
	ans = 0
	i = 10
	while dif != 0:
		if dif / i != 0:
			ans = ans + int(dif / i)
		dif = dif - i * int(dif / i)
		i = i - 1
	print(ans)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	s = abs(a - b)
	x = int(s / 10)
	if s - x * 10 != 0:
		ans = x + 1
	else:
		ans = x
	print(ans)


import sys
pin = sys.stdin.readline
for t in range(int(pin())):
	(a, b) = map(int, pin().split())
	print((abs(b - a) - 1) // 10 + 1)


import sys
from sys import stdin, stdout
import math
import random
import heapq
from collections import Counter
from functools import lru_cache
try:
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		if a == b:
			print(0)
		else:
			diff = abs(a - b)
			if diff % 10 == 0:
				print(diff // 10)
			else:
				print(diff // 10 + 1)
except EOFError as e:
	print(e)


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


def check(a, b):
	arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
	if a == b:
		return 0
	if a > b:
		s = a - b
		q = s // 10
		r = s % 10
		if r in arr:
			q = q + 1
		return q
	elif b > a:
		s = b - a
		q = s // 10
		r = s % 10
		if r in arr:
			q = q + 1
		return q
for _ in range(int(input())):
	(a, b) = input().split()
	print(check(int(a), int(b)))


t = int(input())
for tt in range(t):
	(a, b) = input().split(' ')
	(a, b) = (int(a), int(b))
	ans = abs(a - b) // 10
	if abs(a - b) % 10:
		print(ans + 1)
	else:
		print(ans)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	x = abs(b - a)
	result = x // 10
	if x % 10 != 0:
		result += 1
	print(result)


def main():
	t = int(input())
	for _ in range(t):
		ed = 0
		(a, b) = list(map(int, input().strip().split()))
		dif = abs(a - b)
		ed += dif // 10
		if dif % 10 > 0:
			ed += 1
		print(ed)
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	k = abs(a - b)
	if a == b:
		print('0')
	elif k % 10 == 0:
		m = k // 10
		print(m % 1000000007)
	else:
		p = k // 10 + 1
		print(p % 1000000007)


t = int(input())
for i in range(t):
	(m, n) = [int(m) for m in input().split()]
	z = abs(n - m)
	e = z % 10
	z = z // 10
	if e:
		z += 1
	ans = z
	print(ans)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	count = abs(a - b) // 10
	if abs(a - b) % 10:
		count += 1
	print(count)


def ans(a, b):
	if a == b:
		return 0
	x = abs(a - b)
	if x % 10 == 0:
		return x // 10
	return x // 10 + 1
m = int(input())
for j in range(m):
	arr = input().split()
	a = int(arr[0])
	b = int(arr[1])
	print(ans(a, b))


cases = int(input())
for each in range(0, cases):
	ans = 0
	array = input()
	a = int(array.split(' ')[0])
	b = int(array.split(' ')[-1])
	if a > b:
		nums = range(b, a + 1)
	else:
		nums = range(a, b + 1)
	digits = len(nums) - 2
	if a == b:
		ans = 0
	else:
		ans += digits // 10 + 1
	print(ans)


import math
t = int(input())
ANS = []
for i in range(t):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	if y > x:
		(x, y) = (y, x)
	count = 0
	if x == y:
		ANS.append(0)
	if x != y:
		if x - y <= 10:
			ANS.append(1)
		if x - y > 10:
			temp = math.floor((x - y) / 10)
			if temp != (x - y) / 10:
				temp = temp + 1
			ANS.append(temp)
for i in range(t):
	print(ANS[i])


for i in range(int(input())):
	(a, b) = map(int, input().split())
	x = a % 10
	y = b % 10
	c = a - x
	d = b - y
	if b > a:
		if y > x:
			print(int((d - c) / 10) + 1)
		else:
			print(int((d - c) / 10))
	elif a == b:
		print(0)
	elif x > y:
		print(int((c - d) / 10) + 1)
	else:
		print(int((c - d) / 10))


result = []
for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	difference = abs(a - b)
	if difference % 10 == 0:
		result.append(str(difference // 10))
	else:
		result.append(str(difference // 10 + 1))
print('\n'.join(result))


t = int(input())
for i in range(t):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	if a > b:
		temp = a
		a = b
		b = temp
	if a == b:
		print(0)
	else:
		x = b - a
		count = 0
		j = 10
		while j > 0:
			if x != 0:
				count += x // j
				x = x % j
			else:
				break
			j -= 1
		print(count)


x = int(input())
ans = []
for i in range(x):
	s = input()
	s = s.split()
	a = int(s[0])
	b = int(s[1])
	if a == b:
		ans.append(0)
	elif a > b:
		if (a - b) % 2 == 0:
			ans.append(1)
		else:
			ans.append(2)
	elif (b - a) % 2 == 0:
		ans.append(2)
	else:
		ans.append(1)
for i in ans:
	print(i)


t = int(input())
val = []
for i in range(0, t):
	(a, b) = [int(x) for x in input().split()]
	i = 0
	if a == b:
		val.append(0)
	elif b > a:
		if a % 2 != 0 and b % 2 != 0:
			val.append(2)
		elif a % 2 == 0 and b % 2 == 0:
			val.append(2)
		else:
			val.append(1)
	elif a > b:
		if a % 2 != 0 and b % 2 != 0:
			val.append(1)
		elif a % 2 == 0 and b % 2 == 0:
			val.append(1)
		else:
			val.append(2)
for j in range(0, t):
	print(val[j])


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


import sys, math
mod = 10 ** 9 + 7

def solve(test_index):
	(a, b) = list(map(int, input().split()))
	ans = math.ceil(abs(a - b) / 10)
	print(ans)
	return
if 'PyPy' not in sys.version:
	sys.stdin = open('input.txt', 'r')
sys.setrecursionlimit(100000)
num_tests = 1
num_tests = int(input())
for test in range(1, num_tests + 1):
	solve(test)


for _ in range(int(input())):
	(ar, b) = map(int, input().split())
	count = 0
	if ar == b:
		print('0')
		continue
	else:
		a = 0
		te = 0
		diff = abs(ar - b)
		while diff != 0:
			if diff / 10 >= 1:
				a = diff // 10
				count += a
				diff -= a * 10
			elif diff / 9 >= 1:
				a = diff // 9
				count += a
				diff -= a * 9
			elif diff / 8 >= 1:
				a = diff // 8
				count += a
				diff -= a * 8
			elif diff / 7 >= 1:
				a = diff // 7
				count += a
				diff -= a * 7
			elif diff / 6 >= 1:
				a = diff // 6
				count += a
				diff -= a * 6
			elif diff / 5 >= 1:
				a = diff // 5
				count += a
				diff -= a * 5
			elif diff / 4 >= 1:
				a = diff // 4
				count += a
				diff -= a * 4
			elif diff / 3 >= 1:
				a = diff // 3
				count += a
				diff -= a * 3
			elif diff / 2 >= 1:
				a = diff // 2
				count += a
				diff -= a * 2
			else:
				count += 1
				diff -= 1
		print(count)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	t1 = abs(a - b)
	if a == b:
		print(0)
	elif t1 <= 10:
		print(1)
	else:
		t2 = t1 // 10
		if t2 * 10 == t1:
			print(t2)
		else:
			print(t2 + 1)


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
num = int(z())
for _ in range(num):
	ans = 0
	(a, b) = sorted(zz())
	t = abs(a - b) // 10
	ans += t
	x = abs(a - b) % 10
	if x != 0:
		ans += 1
	print(ans)


n = int(input())
for i in range(n):
	a = list(map(int, input().rstrip().split()))
	x = a[1] - a[0]
	if x < 0 and x % 2 == 0:
		print(1)
	elif (x > 0) & (x % 2 != 0):
		print(1)
	elif x == 0:
		print(0)
	else:
		print(2)


import sys
from collections import deque
input = sys.stdin.readline
T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	n = abs(a - b)
	if n % 10:
		print(n // 10 + 1)
	else:
		print(abs(a - b) // 10)


for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	c = 0
	x = abs(a - b)
	c += x // 10
	if x % 10 != 0:
		c += 1
	print(c)


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


import math
test = int(input())
for i in range(test):
	(a, b) = [int(x) for x in input().split(' ')]
	ans = math.ceil((max(a, b) - min(a, b)) / 10)
	print(ans)


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	if diff % 10 == 0:
		print(diff // 10)
	else:
		print(diff // 10 + 1)


for _ in range(int(input())):
	a = list(map(int, input().split()))
	c = max(a) - min(a)
	if c % 10 == 0:
		print(c // 10)
	else:
		print(c // 10 + 1)


import sys
lines = []
for line in sys.stdin:
	if 'exit' == line.rstrip():
		break
	lines.append(line)
t = int(lines[0])
for case in range(1, t + 1):
	(a, b) = [int(x) for x in lines[case].split(' ')]
	if a == b:
		print(0)
	else:
		ans = abs(b - a) // 10
		d = (b - a) % 10
		if d != 0:
			print(ans + 1)
		else:
			print(ans)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	r = 0
	p = abs(a - b)
	if a < b:
		if p % 2 == 0:
			r = 2
		else:
			r = 1
		print(r)
	elif a > b:
		if p % 2 == 0:
			r = 1
		else:
			r = 2
		print(r)
	else:
		print(0)


t = int(input())
out = list()
for item in range(t):
	ab_list = input().split()
	a = int(ab_list[0])
	b = int(ab_list[1])
	if a == b:
		out.append(0)
	elif a < b:
		if (b - a) % 2 == 1:
			out.append(1)
		else:
			out.append(2)
	elif a > b:
		if (a - b) % 2 == 1:
			out.append(2)
		else:
			out.append(1)
for item in out:
	print(item)


T = int(input())
for t in range(T):
	(a, b) = [int(i) for i in input().split()]
	print((abs(b - a) + 9) // 10)


def main():
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		b -= a
		print((0, 1, 2, 1, 0)[((b > 0) - (b < 0)) * 2 - (b & 1)])
main()


from sys import stdin, stdout
from sys import maxsize
from math import ceil
input = stdin.readline

def solve():
	pass
test = 1
test = int(input().strip())
for t in range(0, test):
	(n, k) = list(map(int, input().strip().split()))
	print(int(ceil(abs(n - k) / 10)))
	ans = solve()


def steps(a, b):
	gap = a - b
	res = gap // 10
	reminder = gap % 10
	if reminder == 0:
		return res
	else:
		return res + 1
n = int(input())
li = []
for _ in range(n):
	(a, b) = map(int, input().split())
	if a > b:
		s = steps(a, b)
		li.append(s)
	elif a == b:
		li.append(0)
	else:
		s = steps(b, a)
		li.append(s)
for items in li:
	print(items)


from math import floor
t = int(input())
while t:
	(a, b) = list(map(int, input().split()))
	print(floor((abs(a - b) + 9) / 10))
	t -= 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		diff = abs(b - a)
		q = diff // 20
		r = diff % 20
		if r == 0:
			print(2 * q)
		elif r <= 10:
			print(2 * q + 1)
		else:
			print(2 * q + 2)


import sys, collections, math

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
mod = 1000000007
for _ in range(int(input())):
	(a, b) = get_ints()
	if a == b:
		print(0)
		continue
	ans = max(a, b) - min(a, b)
	if ans % 10 == 0:
		print(ans // 10)
	else:
		print(ans // 10 + 1)


def main():
	op = ''
	t = int(input())
	for i in range(t):
		(a, b) = map(int, input().split(' '))
		if a == b:
			op += '0\n'
		else:
			moves = 0
			while a != b:
				diff = b - a
				if diff < 0:
					if abs(diff) % 2 == 0:
						a -= abs(diff)
						moves += 1
					else:
						a = a - abs(diff) - 1
						a += 1
						moves += 2
				elif diff % 2 != 0:
					moves += 1
					a += diff
				else:
					a += diff + 1
					a -= 1
					moves += 2
			op += str(moves) + '\n'
	print(op)
main()


def calculate_min_movements(a, b):
	if a == b:
		return 0
	is_positive = b - a > 0
	is_even = (b - a) % 2 == 0
	if is_positive and is_even:
		return 2
	if is_positive and (not is_even):
		return 1
	if not is_positive and is_even:
		return 1
	if not is_positive and (not is_even):
		return 2

def main():
	number_of_cases = int(input())
	for i in range(number_of_cases):
		(a, b) = map(int, input().split(' '))
		print(calculate_min_movements(a, b))
main()


for _ in range(int(input())):
	(A, B) = map(int, input().split())
	print(0 - -abs(A - B) // 10)


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


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nlargest, nsmallest, _heapify_max, _heapreplace_max
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from fractions import Fraction
mod = pow(10, 9) + 7
mod2 = 998244353

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

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	(a, b) = sp()
	if a == b:
		out(0)
		continue
	(pa, pb) = (a & 1, b & 1)
	if a > b:
		if pa == pb:
			out(1)
		else:
			out(2)
	elif pa != pb:
		out(1)
	else:
		out(2)


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


import math
for _ in range(int(input())):
	(a, b) = input().split()
	dis = abs(int(a) - int(b))
	print(math.ceil(dis * 1.0 / 10))


for s in [*open(0)][1::1]:
	from math import ceil
	(a, b) = map(int, s.strip().split())
	print(ceil(abs(a - b) / 10) if abs(a - b) else 0)


n = int(input())
l = []
for i in range(n):
	a = list(map(int, input().split()))
	l.append(a)
for i in range(n):
	x = abs(l[i][0] - l[i][1])
	if x > 10:
		b = int(x / 10)
		c = x % 10
		if c > 0:
			print(b + 1)
		elif c == 0:
			print(b)
	elif x == 0:
		print(0)
	else:
		print(1)


c = int(input())
for x in range(c):
	c = [int(x) for x in input().split(' ')]
	if c[0] > c[1]:
		(c[0], c[1]) = (c[1], c[0])
	if (c[1] - c[0]) / 10 > (c[1] - c[0]) // 10:
		print((c[1] - c[0]) // 10 + 1)
	else:
		print((c[1] - c[0]) // 10)


n = int(input())
ans = [0] * n
for i in range(n):
	s = input().split(' ')
	a = abs(int(s[1]) - int(s[0]))
	ans[i] = a // 10
	if a % 10 != 0:
		ans[i] += 1
for i in range(n):
	print(ans[i])


hold = []
for ___ in range(int(input())):
	moves = 0
	(a, b) = [int(a) for a in input().split()]
	if a == b:
		hold.append(moves)
	if b > a:
		if (b - a) % 2 != 0:
			a += b - a
			moves += 1
			hold.append(moves)
		else:
			moves += 2
			hold.append(moves)
	elif a > b:
		if (a - b) % 2 == 0:
			b -= a
			moves += 1
			hold.append(moves)
		else:
			moves += 2
			hold.append(moves)
for thing in hold:
	print(thing)


n = int(input())
for _ in range(n):
	(a, b) = list(map(int, input().split(' ')))
	if a > b:
		(a, b) = (b, a)
	diff = b - a
	c = 0
	c += diff // 10
	diff = diff % 10
	if diff:
		c += 1
	print(c)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	count = 0
	k = 10
	while diff > 0:
		temp = diff // k
		count += temp
		diff -= temp * k
		k -= 1
	print(count)


n = int(input())
for _ in range(n):
	(a, b) = [int(i) for i in input().split()]
	c = a - b
	print(int(c % 2 and c > 0) + int(c != 0) + int(c % 2 == 0 and c < 0))


for ik in range(int(input())):
	(a, b) = map(int, input().split())
	dif = abs(b - a)
	ans = 0
	for i in range(10, 0, -1):
		ans += dif // i
		dif -= dif // i * i
	print(ans)


ar = list(range(1, 11))
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		c = 0
		d = abs(b - a)
		for i in range(10):
			cu = ar[9 - i]
			c += d // cu
			d %= cu
		print(c)


for q in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	y = b - a
	res = y // 10
	if y % 10 != 0:
		res += 1
	print(res)


test = int(input())
result = []
for t in range(test):
	ab = [int(num) for num in input().split()]
	c = ab[1] - ab[0]
	if c < 0:
		c *= -1
	if c == 0:
		result.append(0)
	elif c % 10 == 0:
		result.append(int(c / 10))
	else:
		result.append(int(c // 10 + 1))
for r in range(len(result)):
	print(result[r])


t = int(input())
p = []
q = []
for i in range(t):
	u = list(map(int, input().split()))
	p.append(u)

def tully(p, q):
	if p > q:
		t = p - q
	else:
		t = q - p
	if t == 0:
		return 0
	else:
		count = t // 10
		if t % 10 == 0:
			return count
		else:
			return count + 1
for i in range(t):
	t = tully(p[i][0], p[i][1])
	print(t)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = 0
	if a == b:
		print(0)
	elif a < b:
		n = b - a
		for i in range(10, 0, -1):
			if i <= n:
				c += n // i
				n = n % i
			elif n == 0:
				break
		print(c)
	else:
		n = a - b
		for i in range(10, 0, -1):
			if i <= n:
				c += n // i
				n = n % i
			elif n == 0:
				break
		print(c)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	rem = abs(a - b)
	i = 10
	count = 0
	while i >= 0:
		temp = rem // i
		if temp > 0:
			count += temp
			rem -= i * temp
		i -= 1
		if rem == 0:
			break
	print(count)


lst = []
for i in range(int(input())):
	tem = input().split()
	a = int(tem[0])
	b = int(tem[1])
	moves = int((abs(a - b) + 9) / 10)
	lst.append(moves)
for i in lst:
	print(i)


for s in [*open(0)][1:]:
	(a, b) = map(int, s.split())
	print((abs(a - b) + 9) // 10)


def main():
	output = []
	num = int(input())
	for i in range(num):
		(a, b) = map(int, input().split())
		diff = b - a
		if diff == 0:
			output.append('0')
		elif diff > 0:
			if diff % 2 == 1:
				output.append('1')
			else:
				output.append('2')
		elif diff % 2 == 0:
			output.append('1')
		else:
			output.append('2')
	print('\n'.join(output))
main()


import math
from collections import deque
import sys
sys.setrecursionlimit(10 ** 4)

def Divisors(n):
	l = []
	i = 2
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
		i = i + 1
	return l

def SieveOfEratosthenes(n):
	l = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			l.append(p)
	return l

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(n)
	return l

def Factors(n):
	result = []
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			if i == n / i:
				result.append(i)
			else:
				result.append(i)
				result.append(n // i)
	result.append(1)
	return result

def maxSubArraySum(a):
	max_so_far = 0
	max_ending_here = 0
	size = len(a)
	for i in range(0, size):
		max_ending_here = max_ending_here + a[i]
		if max_so_far < abs(max_ending_here):
			max_so_far = max_ending_here
	return max_so_far

def longestsubarray(arr, n, k):
	current_count = 0
	max_count = 0
	for i in range(0, n, 1):
		if arr[i] % k != 0:
			current_count += 1
		else:
			current_count = 0
		max_count = max(current_count, max_count)
	return max_count

def main():
	(a, b) = list(map(int, input().split()))
	if (max(a, b) - min(a, b)) % 10 == 0:
		print((max(a, b) - min(a, b)) // 10)
	else:
		print((max(a, b) - min(a, b)) // 10 + 1)
t = int(input())
for i in range(0, t):
	main()


from __future__ import division, print_function

def get_ints():
	return map(int, input().strip().split())

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

def main():
	for _ in range(int(input())):
		(a, b) = get_ints()
		if a == b:
			print(0)
			continue
		if a > b:
			val = a - b
			if not val & 1:
				print(1)
			else:
				difval = (3 // 2 + 1) * 2
				print(2)
		else:
			val = b - a
			if val & 1:
				print(1)
			else:
				print(2)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def solver(pc, py):
	d = abs(pc - py)
	return d // 10 + (1 if d % 10 != 0 else 0)
for i in range(int(input())):
	(pc, pr) = map(int, input().split())
	print(solver(pc, pr))


def gt():
	return list(map(int, input().split()))
(n,) = gt()
while n:
	n -= 1
	(a, b) = gt()
	print((abs(a - b) + 9) // 10)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b) = [int(j) for j in input().split()]
	if a == b:
		print(0)
	else:
		dif = abs(a - b)
		if dif % 10 == 0:
			print(dif // 10)
		else:
			print(dif // 10 + 1)


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


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	d = b - a
	ans = d // 10
	if d % 10:
		ans += 1
	print(ans)


t = int(input())
while t > 0:
	(num1, num2) = list(map(int, input().split(' ')))
	diff = abs(num2 - num1)
	ans = diff // 10
	if diff % 10 != 0:
		ans += 1
	print(ans)
	t -= 1


from math import ceil
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a < b:
		if a % 2 != 0:
			if a % 2 == b % 2:
				print(2)
			else:
				print(1)
		elif a % 2 == b % 2:
			print(2)
		else:
			print(1)
	elif a % 2 != 0:
		if a % 2 == b % 2:
			print(1)
		else:
			print(2)
	elif a % 2 == b % 2:
		print(1)
	else:
		print(2)


def solver(a, b):
	if a > b:
		(a, b) = (b, a)
	return str((b - a) // 10 + 1 * bool((b - a) % 10))
t = int(input())
ans = []
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	ans.append(solver(a, b))
print('\n'.join(ans))


import sys
input = lambda : sys.stdin.readline().strip()
for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	print(0 if a == b else 1 if b - a > 0 and (b - a) % 2 or (b - a < 0 and (b - a) % 2 == 0) else 2)


t = int(input())

def Myfunction(a, b):
	count = 0
	if a == b:
		return 0
	else:
		if a < b:
			temp = b - a
			temp2 = temp // 10
			count = temp2
			temp3 = temp - int(temp2) * 10
			if temp3 < 10 and temp3 != 0:
				count += 1
		else:
			temp = a - b
			temp2 = temp // 10
			count = temp2
			temp3 = temp - int(temp2) * 10
			if temp3 < 10 and temp3 != 0:
				count += 1
		return count
while t != 0:
	(a, b) = map(int, input().split())
	print(Myfunction(a, b))
	t -= 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	p = abs(a - b)
	q = p // 10
	r = p % 10
	if r == 0:
		print(q)
	else:
		print(q + 1)


t = int(input())
while t > 0:
	(a, b) = [int(p) for p in input().split()]
	if a > b:
		if (a - b) % 10 == 0:
			res = (a - b) // 10
		else:
			res = (a - b) // 10 + 1
	elif b > a:
		if (b - a) % 10 == 0:
			res = (b - a) // 10
		else:
			res = (b - a) // 10 + 1
	else:
		res = 0
	print(res)
	t -= 1


t = int(input())
while t:
	(X, Y) = map(int, input().split())
	if X == Y:
		print(0)
	elif X > Y:
		print(1 if not (X - Y) % 2 else 2)
	else:
		print(1 if (Y - X) % 2 else 2)
	t -= 1


from collections import defaultdict as dd
import sys
input = sys.stdin.readline
t = int(input())
while t:
	(n, m) = map(int, input().split())
	dif = abs(n - m)
	ans = dif // 10
	if dif % 10:
		ans += 1
	print(ans)
	t -= 1


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	v = abs(b - a)
	ans = v // 10
	if v % 10 > 0:
		ans += 1
	print(ans)


def main():
	T = eval(input())
	for cas in range(T):
		(a, b) = map(int, input().split())
		print('{}'.format((abs(a - b) + 9) // 10))
main()


for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	l = 0
	while True:
		if a == b:
			print(l)
			break
		if b > a and (b - a) % 10 != 0:
			l = (b - a) // 10 + 1
			print(l)
			break
		if b > a:
			l = (b - a) // 10
			print(l)
			break
		if a > b and (a - b) % 10 != 0:
			l = (a - b) // 10 + 1
			print(l)
			break
		else:
			l = (a - b) // 10
			print(l)
			break


import sys
import math
from math import *
from collections import Counter, defaultdict, deque
lip = lambda : list(map(int, input().split()))
ip = lambda : int(input())
sip = lambda : input().split()

def main():
	(a, b) = lip()
	num = abs(a - b)
	print(math.ceil(num / 10))
for i in range(ip()):
	main()


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	delta = abs(a - b)
	counter = 0
	while delta != 0:
		if delta >= 10:
			step = delta // 10
			delta = delta % 10
			counter += step
		else:
			step = delta % 10
			delta -= step
			counter += 1
	print(counter)


t = int(input())
out = []
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	count = 0
	while a != b:
		if b > a and (b - a) % 2 != 0:
			count += 1
			break
		elif b > a and (b - a) % 2 == 0:
			count += 1
			a += b - a - 1
		elif b < a and (a - b) % 2 == 0:
			count += 1
			break
		else:
			count += 1
			a -= a - b + 1
	out.append(count)
for i in out:
	print(i)


def intm(mas):
	r = []
	for x in mas:
		r.append(int(x))
	return r
k = int(input())
nd = []
for x in range(k):
	v = intm(input().split())
	nd.append(v)
reh = False
max_ = 0
for m in nd:
	reh = False
	if m[0] == m[1]:
		print(0)
	elif m[0] - m[1] < 0:
		if (m[0] - m[1]) / 2 != int((m[0] - m[1]) / 2):
			print(1)
			reh = True
		if reh == False:
			print(2)
	else:
		if (m[0] - m[1]) / 2 == int((m[0] - m[1]) / 2):
			print(1)
			reh = True
		if reh == False:
			print(2)


from sys import stdin

def r():
	return stdin.readline().strip()

def r_t(tp):
	return map(tp, r().strip().split())

def r_l(tp):
	return list(r_t(tp))

def main():
	c = int(r())
	for _ in range(c):
		(a, b) = r_t(int)
		(piv1, piv2) = (a, b)
		if a == b:
			print(0)
		else:
			(a, b) = (max(piv1, piv2), min(piv1, piv2))
			x = a - b
			x = str(a - b)
			if len(x) == 1:
				print(1)
			else:
				print(int(x[:-1]) + 1 * ((a - b) % 10 != 0))
main()


from sys import stdin, stdout

def main():
	t = int(stdin.readline())
	for _ in range(t):
		(a, b) = [int(i) for i in stdin.readline().split()]
		diff = abs(a - b)
		out = diff // 10
		if diff % 10 != 0:
			out += 1
		stdout.write('{0}\n'.format(out))
main()


from sys import stdin, stdout
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()

def main():
	T = int(rl())
	for _ in range(T):
		(a, b) = (int(x) for x in rll())
		d = b - a
		if d == 0:
			stdout.write(str(0))
			stdout.write('\n')
		elif d % 2 == 1:
			if d > 0:
				stdout.write(str(1))
				stdout.write('\n')
			else:
				stdout.write(str(2))
				stdout.write('\n')
		elif d > 0:
			stdout.write(str(2))
			stdout.write('\n')
		else:
			stdout.write(str(1))
			stdout.write('\n')
	stdout.close()
main()


import math

def yetAnotherTwoIntegersProblem(a: int, b: int) -> int:
	return math.ceil(abs(a - b) / 10)
test_cases = int(input())
for _ in range(test_cases):
	inputs = list(map(int, input().split(' ')))
	print(yetAnotherTwoIntegersProblem(inputs[0], inputs[1]))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		som = 0
		if b > a:
			(a, b) = (b, a)
		som = som + (a - b) // 10
		if (a - b) % 10 == 0:
			print(som)
		else:
			print(som + 1)


t = int(input())
l = []
for i in range(t):
	inp = list(map(int, input().split()))
	l.extend(inp)
for i in range(t):
	(a, b) = (l[2 * i], l[2 * i + 1])
	if a == b:
		print(0)
		continue
	even = 0
	if (a - b) % 2 == 0:
		even = 1
	if a < b:
		n = even + 1
	else:
		n = 2 - even
	print(n)


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = max(a, b)
	d = min(a, b)
	diff = c - d
	ans = math.ceil(diff / 10)
	print(ans)


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


a = int(input())
for i in range(a):
	st = str(input()).split(' ')
	print((abs(int(st[0]) - int(st[1])) + 9) // 10)


import math

def MinimumStepEquals(a, b):
	diff = abs(a - b)
	return math.ceil(diff / 10)
t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	print(MinimumStepEquals(a, b))
	t -= 1


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
testCases = int(input())
while testCases != 0:
	(a, b) = get_ints()
	gobbldygook = abs(a - b)
	if gobbldygook % 10 == 0:
		print(int(gobbldygook / 10))
	else:
		print(int(gobbldygook / 10 + 1))
	testCases -= 1


import sys
from sys import stdin
import math

def iinput():
	return int(input())

def minput():
	return map(int, input().split())

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

def fiinput():
	return int(stdin.readline())

def fminput():
	return map(int, stdin.readline().strip().split())

def flinput():
	return list(map(int, stdin.readline().strip().split()))
for _ in range(iinput()):
	(a, b) = minput()
	d = abs(a - b)
	print(math.ceil(d / 10))


for _ in range(int(input())):
	m = list(map(int, input().split()))
	a = min(m)
	b = max(m)
	if a == b:
		print(0)
	elif str(a)[-1] == str(b)[-1]:
		print((b - a) // 10)
	else:
		print((b - a) // 10 + 1)


t = int(input())
for i in range(t):
	(a, b) = sorted(map(int, input().split()))
	if a == b:
		print(0)
	elif (b - a) % 10 == 0:
		print((b - a) // 10)
	else:
		print((b - a) // 10 + 1)


t = int(input())
for q in range(t):
	ab = input().split(' ')
	a = int(ab[0])
	b = int(ab[1])
	k = 0
	dif = b - a if b - a > 0 else a - b
	(k, r) = (dif // 10, dif % 10)
	print(k + 1 if r != 0 else k)


n = int(input())
for _ in range(n):
	(left, right) = map(int, input().split())
	if left < right:
		a = left
		b = right
	else:
		b = left
		a = right
	c = abs(a - b)
	count = 0
	if c % 10 == 0:
		count = c // 10
	else:
		count = c // 10 + 1
	print(count)


import math as m
t = int(input())
while t > 0:
	a = list(map(int, input().split()))
	print(m.ceil((max(a) - min(a)) / 10))
	t -= 1


x = int(input())

def is_odd(x):
	if x % 2 == 1:
		return True
	else:
		return False
for i in range(x):
	lista = list(map(int, input().split()))
	a = lista[0]
	b = lista[1]
	dif = a - b
	if dif == 0:
		print(0)
	elif is_odd(dif):
		if dif < 0:
			print(1)
		else:
			print(2)
	elif dif > 0:
		print(1)
	else:
		print(2)


t = int(input())
for i in range(t):
	nums = [int(i) for i in input().split()]
	a = nums[0]
	b = nums[1]
	tries = max(a, b) - min(a, b)
	if tries % 10 == 0:
		print(tries // 10)
	else:
		print(tries // 10 + 1)


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	t = int(input())
	for i in range(t):
		(a, b) = map(int, input().split())
		print(math.ceil(abs(a - b) / 10))
main()


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

def inp():
	return int(input())

def inps():
	return input().rstrip()

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

def _debug(obj):
	print(obj, file=sys.stderr)
n = inp()
for i in range(n):
	(a, b) = inpl()
	b = abs(a - b)
	syo = b // 10
	amari = b % 10
	amari = 1 if amari != 0 else 0
	print(syo + amari)


n = int(input())
for i in range(n):
	(l, m) = map(int, input().split())
	x = abs(l - m)
	y = x // 10
	if x % 10 != 0:
		print(y + 1)
	else:
		print(y)


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	diff = abs(a - b)
	if diff % 10 == 0:
		move = diff // 10
	else:
		move = diff // 10 + 1
	print(move)


T = 0
try:
	T = int(input())
except:
	pass
out = []
a = 0
b = 0
for i in range(0, T):
	try:
		(a, b) = input().split(' ')
		a = int(a)
	except:
		pass
	b = int(b)
	c = a % 2
	d = b % 2
	if a == b:
		out.append(0)
	elif a > b:
		if c - d == 0:
			out.append(1)
		else:
			out.append(2)
	elif c == d:
		out.append(2)
	else:
		out.append(1)
for k in out:
	print(k)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	if b < a:
		(b, a) = (a, b)
	dif = b - a
	print(dif // 10 + int(dif % 10 >= 1))


from math import *
t = int(input())
for zz in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif b < a and b % 2 == a % 2:
		print(1)
	elif b > a and b % 2 == (a + 1) % 2:
		print(1)
	else:
		print(2)


t = int(input())
for i in range(t):
	(a, b) = tuple(map(int, input().split()))
	sub = abs(a - b)
	moves = sub // 10 + (1 if sub % 10 > 0 else 0)
	print(moves)


from math import ceil
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	(s, m) = (max(a, b), min(a, b))
	print([0, ceil((s - m) / 10)][a != b])


n = int(input())
al = []
bl = []
il = []
for i in range(n):
	(a1, b1) = map(int, input().split())
	al.append(a1)
	bl.append(b1)
for j in range(n):
	a = al[j]
	b = bl[j]
	x = abs(a - b)
	if x % 2 == 0:
		if x == 0:
			il.append(0)
		elif a > b:
			il.append(1)
		else:
			il.append(2)
	elif a < b:
		il.append(1)
	else:
		il.append(2)
for z in range(n):
	print(il[z])


def solve(a, b):
	diff = a - b
	if diff == 0:
		return 0
	elif diff < 0:
		if diff % 2 == 1:
			return 1
		else:
			return 2
	elif diff % 2 == 1:
		return 2
	else:
		return 1

def main():
	N = int(input())
	for _ in range(N):
		(a, b) = list(map(int, input().split()))
		print(solve(a, b))
main()


t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	k = abs(a - b)
	i = 10
	cnt = 0
	while i:
		cnt += k // i
		k = k % i
		i -= 1
	print(cnt)


from sys import stdin
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(t,) = gil()
for _ in range(t):
	(a, b) = gil()
	d = abs(a - b)
	ans = d // 10 + (1 if d % 10 else 0)
	print(ans)


def solve():
	(a, b) = map(int, input().split())
	count = 0
	(a, b) = (max(a, b), min(a, b))
	if a % 10 > b % 10:
		count += 1
	count += a // 10 - b // 10
	print(count)
t = int(input())
for x in range(t):
	solve()


import math
from collections import defaultdict
for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	k = abs(a - b)
	kk = k % 10
	if kk == 0:
		print(k // 10)
	else:
		print(k // 10 + 1)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	ans = 0
	while a != b:
		if a > b:
			if a - b > 10:
				times = (a - b) // 10
				a = a - 10 * times
				ans += times
			else:
				a -= a - b
				ans += 1
		elif b - a > 10:
			times = (b - a) // 10
			a = a + 10 * times
			ans += times
		else:
			a += b - a
			ans += 1
	print(ans)


import math as m
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	print(m.ceil(abs(x - y) / 10))


t = int(input())
ans = []
for i in range(t):
	ab = input().split(' ')
	a = int(ab[0])
	b = int(ab[1])
	if a > b:
		if (a - b) % 2 == 0 and a - (a - b) == b:
			ans.append(1)
		else:
			ans.append(2)
	elif a < b:
		if (a - b) % 2 > 0 and a + (b - a) == b:
			ans.append(1)
		else:
			ans.append(2)
	else:
		ans.append(0)
for o in range(len(ans)):
	print(ans[o])


import math
case = int(input())
for i in range(0, case):
	(x, y) = [int(x) for x in input().split()]
	print(math.ceil(abs(y - x) / 10))


t = int(input())
while t:
	(a, b) = [int(x) for x in input().split()]
	if abs(a - b) % 10:
		res = int(abs(a - b) / 10) + 1
	else:
		res = int(abs(a - b) / 10)
	print(str(res) + '\n')
	t -= 1


t = int(input())
answers = []
for ti in range(t):
	(a, b) = list(map(int, input().split()))
	if a == b:
		answers.append(0)
	elif a < b:
		if (b - a) % 2 == 1:
			answers.append(1)
		else:
			answers.append(2)
	elif (a - b) % 2 == 0:
		answers.append(1)
	else:
		answers.append(2)
for a in answers:
	print(a)


n = int(input())
for i in range(n):
	(a, b) = [int(i) for i in input().split()]
	if a == b:
		print(0)
	elif a > b:
		e = a - b
		if e <= 10:
			print(1)
		else:
			c = e // 10
			if e % 10 == 0:
				print(c)
			else:
				print(c + 1)
	else:
		e = b - a
		if e <= 10:
			print(1)
		else:
			c = e // 10
			if e % 10 == 0:
				print(c)
			else:
				print(c + 1)


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


t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	if l[0] > l[1]:
		c = l[0] - l[1]
	else:
		c = l[1] - l[0]
	d = c % 10
	c = c // 10
	if d > 0:
		c = c + 1
	print(c)


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


n = int(input())
s = [list(map(int, input().split())) for i in range(n)]
for v in s:
	t = abs(v[1] - v[0])
	ans = t // 10
	if t % 10 != 0:
		ans += 1
	print(ans)


import sys, collections
tc = int(sys.stdin.readline())
for _ in range(tc):
	(a, b) = map(int, sys.stdin.readline().split())
	if abs(a - b) % 10 != 0:
		print(abs(a - b) // 10 + 1)
	else:
		print(abs(a - b) // 10)


from sys import stdin
import math

def input():
	return stdin.readline().rstrip()
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(math.ceil(abs(b - a) / 10))


c = []
for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	d = abs(b - a)
	if d % 10 != 0:
		c.append(d // 10 + 1)
	else:
		c.append(d // 10)
for i in c:
	print(i)


a = int(input())
b = 0
while b < a:
	e = input().split(' ')
	c = int(e[0])
	d = int(e[1])
	if c == d:
		print(0)
	elif abs(c - d) % 10 == 0:
		print(abs(c - d) // 10)
	else:
		print(abs(c - d) // 10 + 1)
	b = b + 1


def solve(a, b):
	if a == b:
		res = 0
	elif abs(a - b) <= 10:
		res = 1
	else:
		res = abs(a - b) // 10
		if abs(a - b) % 10 > 0:
			res += 1
	print(res)
t = int(input())
for _ in range(t):
	inp = input().split()
	(a, b) = (int(inp[0]), int(inp[1]))
	solve(a, b)


(N,) = map(int, input().split())
for _ in range(N):
	(a, b) = map(int, input().split())
	print(-(-abs(b - a) // 10))


t = int(input())
for hh in range(0, t):
	(a, b) = [int(x) for x in input().split()]
	if a == b:
		ans = 0
	else:
		diff = abs(b - a)
		mx = diff // 10
		ans = diff // 10
		rem = diff - mx * 10
		if rem > 0:
			ans += 1
	print(ans)


from __future__ import division, print_function
import os
import sys
import math
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		print(int(math.ceil(abs(b - a) / 10)))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


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


from sys import stdin, stdout
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	var = b - a
	if var % 10 == 0:
		print(var // 10)
	else:
		var = var // 10
		print(var + 1)


import sys
input = sys.stdin.readline
t = int(input())
while t != 0:
	t -= 1
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	cnt = abs(b - a) // 10
	if abs(b - a) % 10 == 0:
		print(cnt)
		continue
	print(cnt + 1)


from fractions import gcd
from itertools import combinations, permutations, accumulate, product
from collections import deque, defaultdict, Counter
import decimal
import re
import math
import bisect
import sys
sys.setrecursionlimit(10000000)
mod = 10 ** 9 + 7
from sys import stdin
readline = stdin.readline

def readInts():
	return list(map(int, readline().split()))

def readTuples():
	return tuple(map(int, readline().split()))

def I():
	return int(readline())
for _ in range(I()):
	(a, b) = readInts()
	sa = abs(a - b)
	ans = sa // 10
	ans += 1 if sa % 10 else 0
	print(ans)


t = input()
t = int(t)
ans = []
for i in range(t):
	x = input().split()
	x = list(map(int, x))
	if (x[0] - x[1]) % 10 == 0:
		ans.append(abs(x[0] - x[1]) // 10)
	else:
		ans.append(abs(x[0] - x[1]) // 10 + 1)
for i in ans:
	print(i)


import collections

def solve(a, b):
	aParity = a % 2
	bParity = b % 2
	if a == b:
		return 0
	elif a < b and aParity ^ bParity == 1 or (a > b and aParity ^ bParity == 0):
		return 1
	else:
		return 2
t = int(input().strip())
for i in range(t):
	[a, b] = list(map(int, input().strip().split()))
	print(solve(a, b))


n = eval(input())
for i in range(n):
	a = input()
	a = a.split()
	b = eval(a[1])
	a = eval(a[0])
	steps = 1
	diff = a - b
	if diff > 0:
		if diff % 2 == 0:
			print(steps)
		else:
			print(steps + 1)
	elif diff == 0:
		print(0)
	elif diff % 2 != 0:
		print(steps)
	else:
		print(steps + 1)


n = int(input())
e = []
count = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if a == b:
		count = 0
		e.append(count)
	if a > b:
		r1 = a - b
		if r1 % 2 == 0:
			count = 1
		else:
			count = 2
		e.append(count)
	if b > a:
		r = b - a
		if r % 2 != 0:
			count = 1
		else:
			count = 2
		e.append(count)
for i in range(len(e)):
	print(e[i])


from operator import xor
for t in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		print(2) if xor((a % 2 == 0) == (b % 2 == 0), a > b) else print(1)


T = int(input())
while T > 0:
	inp = input().split()
	a = int(inp[0])
	b = int(inp[1])
	diff = abs(a - b)
	if diff % 10 == 0:
		print(diff // 10)
	else:
		print(diff // 10 + 1)
	T -= 1


t = int(input())
l = [i for i in range(1, 11)]
for i in range(t):
	count = 0
	(a, b) = map(int, input().split(' '))
	if a > b:
		while a != b:
			c = a - b
			if c in l:
				count += 1
				a -= c
			else:
				d = c // 10
				count += d
				a -= 10 * d
	elif b > a:
		while a != b:
			c = b - a
			if c in l:
				count += 1
				a += c
			else:
				d = c // 10
				count += d
				a += 10 * d
	print(count)


ans = list()
n = int(input())
for i in range(0, n):
	(x, y) = [int(x) for x in input().split()]
	if x > y:
		if (x - y) % 2 == 0:
			k = 1
		else:
			k = 2
	elif y > x:
		if (y - x) % 2 != 0:
			k = 1
		else:
			k = 2
	else:
		k = 0
	ans = ans + [k]
for i in range(0, n):
	print(ans[i])


from math import *
from bisect import *
from collections import *
from decimal import *

def inp():
	return int(input())

def st():
	return input().rstrip('\n')

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

def ma():
	return map(int, input().split())
t = inp()
while t:
	t -= 1
	(n, m) = ma()
	z = abs(n - m)
	r = z // 10
	if z % 10:
		r += 1
	print(r)


t = int(input())
for i in range(t):
	inp = input().split()
	(a, b) = (int(inp[0]), int(inp[1]))
	res = abs(a - b)
	ans = res // 10
	if res % 10 > 0:
		ans += 1
	print(ans)


n = int(input())

def solve(a, b):
	if abs(a - b) % 10 == 0:
		return abs(a - b) // 10
	else:
		return abs(a - b) // 10 + 1
for i in range(n):
	(a, b) = map(int, input().split(' '))
	print(solve(a, b))


def ans(a, b):
	temp = abs(b - a)
	cnt = temp // 10
	if temp % 10:
		cnt += 1
	return cnt
t = int(input())
for _ in range(t):
	ab = list(map(int, input().strip().split()))
	print(ans(ab[0], ab[1]))


t = int(input())
for case in range(t):
	(a, b) = list(map(int, input().split()))
	diff = abs(a - b)
	print((diff + 9) // 10)


t = int(input())
for __ in range(t):
	(a, b) = map(int, input().split(' '))
	if a > b:
		n = (a - b) // 10
		if (a - b) % 10 > 0:
			n += 1
		print(n)
	elif b > a:
		n = (b - a) // 10
		if (b - a) % 10 > 0:
			n += 1
		print(n)
	else:
		print(0)


T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a > b:
		count = 0
		x = a - b
		if x <= 10:
			count += 1
			print(count)
		else:
			c = x // 10
			c1 = x % 10
			count += c
			if c1 != 0:
				count += 1
			print(count)
	else:
		x = b - a
		count = 0
		if x <= 10:
			count += 1
			print(count)
		else:
			c = x // 10
			count += c
			c1 = x % 10
			if c1 != 0:
				count += 1
			print(count)


import sys
import math

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]
t = read_int()
for i in range(t):
	(a, b) = read_int_line()
	if a == b:
		print(0)
	elif a < b:
		if a % 2 == 0 and b % 2 == 0:
			print(2)
		elif a % 2 == 0 and b % 2 != 0:
			print(1)
		elif a % 2 != 0 and b % 2 == 0:
			print(1)
		elif a % 2 != 0 and b % 2 != 0:
			print(2)
	elif a % 2 == 0 and b % 2 == 0:
		print(1)
	elif a % 2 == 0 and b % 2 != 0:
		print(2)
	elif a % 2 != 0 and b % 2 == 0:
		print(2)
	elif a % 2 != 0 and b % 2 != 0:
		print(1)


stp = 0
ans = []
t = int(input())
for i in range(t):
	number = list(map(int, input().split()))
	(a, b) = number
	if a > b:
		temp = a - b
		if temp % 2 == 0:
			ans.append(1)
		else:
			ans.append(2)
	if a < b:
		temp = b - a
		if temp % 2 == 0:
			ans.append(2)
		else:
			ans.append(1)
	if a == b:
		ans.append(0)
for i in ans:
	print(i)


for i in range(int(input())):
	x = input().strip().split()
	x1 = int(x[0])
	x2 = int(x[1])
	ans = abs(x2 - x1) // 10
	if abs(x2 - x1) % 10 != 0:
		ans += 1
	if x2 != x1:
		print(ans)
	else:
		print(0)


def solve(n, k):
	diff = abs(n - k)
	if diff % 10 == 0:
		print(diff // 10)
	else:
		print(diff // 10 + 1)
t = int(input())
for i in range(t):
	a = list(map(int, input().split()))
	solve(a[0], a[1])


num = int(input())
for i in range(num):
	str = input()
	a = int(str.split(' ')[0])
	b = int(str.split(' ')[1])
	if a == b:
		print(0)
	elif a < b and (b - a) % 2 == 0 or (a > b and (a - b) % 2 == 1):
		print(2)
	else:
		print(1)


def sub(a, b):
	count = 0
	t = 10
	k = (a - b) // 10 * 10
	a = a - k
	count += k // 10
	while a != b:
		t = min(abs(a - b), t)
		a = a - t
		count += 1
	return count

def add(a, b):
	count = 0
	t = 10
	k = (b - a) // 10 * 10
	a = a + k
	count += k // 10
	while a != b:
		t = min(b - a, t)
		a = a + t
		count += 1
	return count
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	gap = a - b
	if gap == 0:
		print(0)
	if gap > 0:
		print(sub(a, b))
	if gap < 0:
		print(add(a, b))


def i_len(a, b):
	j = 0
	for i in str(b - a):
		j += 1
	return int(j)

def chislo(a, b, count, abc):
	if a > b:
		(a, b) = (b, a)
	if a < b:
		abc = (b - a) % 10
		count += (b - a) // 10
		if abc in range(1, 10):
			count += 1
			return count
		else:
			return count
	else:
		return count
_list = []
n = int(input())
for i in range(0, n):
	(a, b) = input().split(' ', 1)
	count = 0
	abc = 0
	_list.append(chislo(int(a), int(b), count, abc))
for i in _list:
	print(i)


number_of_tests = int(input())
for i in range(number_of_tests):
	(a, b) = [int(i) for i in input().split()]
	output = 0
	output += abs(a - b) // 10
	if abs(a - b) % 10 > 0:
		output += 1
	else:
		pass
	print(output)


n = int(input())
ans = []
for i in range(0, n):
	ab = input()
	absp = ab.split()
	a = int(absp[0])
	b = int(absp[1])
	if a - b < 0:
		if (a - b) * -1 % 2 == 0:
			ans.append('2')
		else:
			ans.append('1')
	elif a - b == 0:
		ans.append('0')
	elif (a - b) % 2 == 0:
		ans.append('1')
	else:
		ans.append('2')
for i in range(0, n):
	print(ans[i])


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n < m:
		if (n - m) % 2 == 0:
			print(2)
		else:
			print(1)
	elif m == n:
		print(0)
	elif (m - n) % 2 == 0:
		print(1)
	else:
		print(2)


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


import sys
from sys import stdin, stdout
import bisect
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
import math

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l
x = []

def main():
	t = inin()
	for _ in range(t):
		(a, b) = cin()
		x = b - a
		if x > 0 and x % 2 == 0:
			print(2)
		elif x < 0 and x % 2 == 1:
			print(2)
		elif x == 0:
			print(0)
		else:
			print(1)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


def findmoves(a, b):
	remainder = b % a
	(larger, smaller) = (max(a, b), min(a, b))
	if larger == smaller:
		return 0
	div = larger // 10
	div1 = smaller // 10
	difference = div - div1
	larger = larger - 10 * difference
	if larger <= smaller:
		counter = difference
	elif larger > smaller:
		counter = difference + 1
	return counter
k = int(input())
tmp_list = []
for _ in range(k):
	(a, b) = map(int, input().split())
	k = findmoves(a, b)
	tmp_list.append(k)
for i in tmp_list:
	print(i)


t = int(input())
for i in range(0, t):
	(a, b) = map(int, input().split())
	ans = (abs(a - b) + 9) // 10
	print(ans)


a = []
t = int(input())
for i in range(t):
	l = list(input().split(' '))
	l = [int(i) for i in l]
	result = abs(l[1] - l[0]) // 10
	if (l[1] - l[0]) % 10 == 0:
		a.append(result)
	else:
		a.append(result + 1)
for i in a:
	print(i)


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


def change(a, b):
	dif = a - b
	while 1:
		if dif == 0:
			return 0
		if dif < 0:
			if abs(dif) % 2 == 1:
				return 1
			else:
				return 2
		if dif > 0:
			if abs(dif) % 2 == 1:
				return 2
			else:
				return 1
n = int(input())
for i in range(n):
	(a, b) = [int(k) for k in input().split()]
	print(change(a, b))


def find(a, b):
	if a == b:
		return 0
	else:
		ans = abs(a - b)
		f = int(ans // 10)
		if ans % 10 != 0:
			return f + 1
		return f
t = int(input())
for tt in range(t):
	(a, b) = map(int, input().split())
	print(find(a, b))


import random

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

def lcm(a, b):
	return a * b / gcd(a, b)
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		if (b - a) % 2 == 0:
			print(1)
		else:
			print(2)
	elif (b - a) % 2 == 1:
		print(1)
	elif b == a:
		print(0)
	else:
		print(2)


for _ in range(int(input())):
	(a, b) = sorted(list(map(int, input().strip().split(' '))))
	if (b - a) % 10 != 0:
		print((b - a) // 10 + 1)
	else:
		print((b - a) // 10)


def moves(a, b):
	if a == b:
		return 0
	if b - a > 0:
		if (b - a) % 2 == 0:
			return 2
		else:
			return 1
	elif abs(b - a) % 2 == 0:
		return 1
	else:
		return 2
testcases = int(input())
for i in range(1, testcases + 1):
	data = tuple(map(int, input().split()))
	print(moves(data[0], data[1]))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	(a, b) = sep()
	(a, b) = (min(a, b), max(a, b))
	rem = b - a
	ans = ceil(rem / 10)
	print(ans)
testcase(int(inp()))


import math
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	r = math.ceil(x / 10)
	print(r)


ANS = []

def solve():
	(a, b) = map(int, input().split())
	d = int(max(a - b, b - a))
	ANS.append(int((d + 9) / 10))
q = int(input())
while q > 0:
	q -= 1
	solve()
for x in ANS:
	print(x)


t = int(input())
while t:
	(a1, b1) = map(int, input().split())
	a = min(a1, b1)
	b = max(a1, b1)
	cnt = (b - a) // 10
	if (b - a) % 10 != 0:
		cnt += 1
	print(cnt)
	t -= 1


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))

def parr():
	return [value() for i in range(n)]
mo = 1000000007
for _ in range(inn()):
	(n, m) = value()
	res = abs(n - m)
	ans = res // 10
	if res % 10 != 0:
		ans += 1
	print(ans)


import math
t = int(input())
for i in range(t):
	(a, b) = [int(i) for i in input().split()]
	print(math.ceil(math.fabs(b - a) / 10))


def main():
	t = Iint()
	for _ in range(t):
		(a, b) = Imap()
		k = abs(a - b)
		(k1, k2) = (k // 10, k % 10)
		if k2:
			k1 += 1
		print(k1)
FIO = 10

def I():
	return input()

def Iint():
	return int(input())

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

def Imap():
	return map(int, input().split())

def Plist(li, s=' '):
	print(s.join(map(str, li)))
en = enumerate

def log(*args):
	print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)
	return
if FIO:
	from io import BytesIO, IOBase
	import sys
	import os
elif __name__ == '__main__':
	main()
	exit()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


def func(a, b):
	first = abs(a - b)
	c = first // 10
	if first % 10 != 0:
		c += 1
	print(c)
	return
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	func(a, b)


import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import ceil

def main():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		if a == b:
			print(0)
		else:
			ab = b - a
			if ab > 0:
				r = ceil((b - a) / 10)
			else:
				r = ceil((a - b) / 10)
			print(r)
main()


t = int(input())
for i in range(t):
	(a, b) = [int(s) for s in input().split()]
	print(abs(b - a) // 10 + int(abs(b - a) % 10 != 0))


for t in range(int(input())):
	(a, b) = map(int, input().split(' '))
	if a > b:
		(a, b) = (b, a)
	diff = b - a
	ans = 0
	for i in range(10, 0, -1):
		ans += diff // i
		diff = diff % i
	print(ans)


import sys
input = sys.stdin.readline
Q = int(input())
Query = [list(map(int, input().split())) for _ in range(Q)]
for (A, B) in Query:
	if A == B:
		ans = 0
	elif A < B:
		if (B - A) % 2 == 0:
			ans = 2
		else:
			ans = 1
	elif (A - B) % 2 == 0:
		ans = 1
	else:
		ans = 2
	print(ans)


n_tests = int(input())
for i in range(n_tests):
	(a, b) = (int(x) for x in input().split())
	parity = abs(a - b) % 2
	if a == b:
		print(0)
	elif parity == 0 and a > b or (parity == 1 and b > a):
		print(1)
	else:
		print(2)


def count_operations(a, b):
	difference = b - a
	if difference == 0:
		return 0
	if difference % 10 == 0:
		return abs(int(difference / 10))
	else:
		return abs(int(difference / 10)) + 1
t = int(input())
data = []
for i in range(t):
	(a, b) = input().split()
	data.append((int(a), int(b)))
for values in data:
	print(count_operations(values[0], values[1]))


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


import sys

def rint():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().rstrip('\n')

def oint():
	return int(input())
t = oint()
for _ in range(t):
	(a, b) = rint()
	if a < b:
		if (b - a) % 2:
			print(1)
		else:
			print(2)
	elif a > b:
		if (a - b) % 2:
			print(2)
		else:
			print(1)
	else:
		print(0)


def patanhi(a, b):
	x = a - b
	if x < 0:
		if x % 2 != 0:
			ans = 1
		else:
			ans = 2
	if x == 0:
		ans = 0
	if x > 0:
		if (b - a) % 2 == 0:
			ans = 1
		else:
			ans = 2
	return ans
t = int(input())
for i in range(t):
	(a, b) = [int(i) for i in input().split()]
	ans = patanhi(a, b)
	print(ans)


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


for i in range(int(input())):
	(first, second) = map(int, input().split())
	if first == second:
		print(0)
	else:
		print((max(first, second) - min(first, second) + 9) // 10)


import sys
input = sys.stdin.readline
from collections import defaultdict
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	c = b - a
	x = c // 10
	y = c - x * 10
	print(x + min(y, 1))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		move = -((b - a) // 10)
	elif b > a:
		move = -((a - b) // 10)
	else:
		move = 0
	print(move)


from sys import stdin, stdout

def calculate(a, b):
	diff = abs(b - a)
	if diff % 10 == 0:
		return str(int(diff / 10))
	else:
		return str(int(diff / 10) + 1)
sollist = []
solution = []
N = int(stdin.readline())
for i in range(N):
	buffer = stdin.readline()
	a = int(buffer.split()[0])
	b = int(buffer.split()[1])
	sollist.append([a, b])
for i in range(N):
	work = sollist[i]
	print(calculate(work[0], work[1]))


t = int(input())
for h in range(t):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	ans = c // 10 + int(c % 10 != 0)
	print(ans)


import sys
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

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 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')
INF = 10 ** 18
MOD = 998244353
for _ in range(int(ri())):
	(a, b) = Ri()
	if a == b:
		print(0)
	elif a < b:
		if (b - a) % 2 == 0:
			print(2)
		else:
			print(1)
	elif (b - a) % 2 == 1:
		print(2)
	else:
		print(1)


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()

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


def solve(a, b):
	if a > b:
		(a, b) = (b, a)
	diff = b - a
	n = diff // 10
	if diff % 10 != 0:
		n += 1
	return n
t = int(input())
for i in range(t):
	(a, b) = (int(x) for x in input().split())
	print(solve(a, b))


import io, os
inp = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
inar = lambda : list(map(int, inp().split()))
inin = lambda : int(inp())
inst = lambda : inp().decode().strip()
_T_ = inin()
for _t_ in range(_T_):
	(a, b) = inar()
	print(int(abs(a - b) / 10 + 0.9))


def function(list_):
	(a, b) = (list_[0], list_[1])
	if b > a:
		if (b - a) % 2 == 1:
			print(1)
		else:
			print(2)
	elif a > b:
		if (a - b) % 2 == 0:
			print(1)
		else:
			print(2)
	else:
		print(0)
t = int(input())
for i in range(t):
	list_param = input().split(' ')
	list_ = list(map(int, list_param))
	function(list_)


import sys

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

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
mod = int(1000000000.0) + 7
for _ in range(iinput()):
	(a, b) = rinput()
	diff = abs(b - a)
	if diff % 10 == 0:
		print(diff // 10)
	else:
		print(diff // 10 + 1)


Testcase = int(input())
for i in range(Testcase):
	Moves = 0
	Inputs = list(map(int, input().split()))
	a = Inputs[0]
	b = Inputs[1]
	Temp = abs(b - a)
	Moves = Temp // 10
	Temp -= Moves * 10
	while Temp != 0:
		Temp = 0 if Temp < 11 else Temp - 10
		Moves += 1
	print(Moves)


n = input()
n = int(n)
list1 = []
list2 = []
for i in range(n):
	(x, y) = input().split()
	list1.append(int(x))
	list2.append(int(y))

def checkso(a, b):
	if a == b:
		print(0)
	elif a % 2 == 0 and b % 2 == 0:
		if a > b:
			print(1)
		else:
			print(2)
	elif a % 2 == 0 and b % 2 == 1:
		if a > b:
			print(2)
		else:
			print(1)
	elif a % 2 == 1 and b % 2 == 1:
		if a > b:
			print(1)
		else:
			print(2)
	elif a % 2 == 1 and b % 2 == 0:
		if a > b:
			print(2)
		else:
			print(1)
for j in range(n):
	checkso(list1[j], list2[j])


def solve(a, b):
	diff = abs(a - b)
	return (diff + 10 - 1) // 10
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	print(solve(a, b))


q = int(input())
while q:
	steps = 0
	q = q - 1
	ab = [int(x) for x in input().split()]
	while ab[0] != ab[1]:
		if ab[0] > ab[1]:
			steps = steps + 1 + (ab[0] - ab[1]) % 2
		else:
			steps = steps + 1 + abs(1 - (ab[1] - ab[0]) % 2)
		break
	print(steps)


for _ in range(int(input())):
	(m, n) = map(int, input().split())
	if m == n:
		print('0')
	else:
		maxi = max(m, n)
		mini = min(m, n)
		res = maxi - mini
		q = res // 10
		rem = res % 10
		print(q) if rem == 0 else print(q + 1)


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


def way(a, b):
	diff = a - b
	count = 0
	for k in range(1, 11):
		way = diff // (11 - k)
		count += way
		diff = diff - diff // (11 - k) * (11 - k)
	print(count)
t = int(input())
for case in range(t):
	(a, b) = map(int, input().split(' '))
	if a >= b:
		way(a, b)
	else:
		way(b, a)


t = int(input())
ans = []
while t > 0:
	(a, b) = map(int, input().split())
	t -= 1
	k = n = 0
	if a == b:
		ans.append(0)
	if a > b:
		if a - b > 10:
			n = (a - b) // 10
			k += n
			if (a - b) % 10 == 0:
				ans.append(k)
			else:
				ans.append(k + 1)
		else:
			ans.append(1)
	if a < b:
		if b - a > 10:
			n = (b - a) // 10
			k += n
			if (b - a) % 10 == 0:
				ans.append(k)
			else:
				ans.append(k + 1)
		else:
			ans.append(1)
for i in ans:
	print(i)


for _ in [0] * int(input()):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	if c % 2 == 0 and a < b:
		print('2')
	elif a == b:
		print('0')
	elif c % 2 == 0 and a > b:
		print('1')
	elif c % 2 != 0 and a < b:
		print('1')
	else:
		print('2')


import sys, threading
from collections import defaultdict, Counter
input = sys.stdin.readline

def rl(type):
	return [type(w) for w in input().split()]

def reverse(arr):
	return arr[-1::-1]

def mod(a, m):
	return (a % m + m) % m

def create_graph(n):
	graph = {}
	for _ in range(n):
		(x, y) = map(int, input().split())
		graph[x].append(y)
		graph[y].append(x)
	return graph

def main():
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		temp = abs(a - b)
		result = temp // 10 + (1 if temp % 10 else 0)
		print(result)
sys.setrecursionlimit(10 ** 6)
threading.stack_size(10 ** 8)
t = threading.Thread(target=main)
t.start()
t.join()


from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin, tan

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline()

def sieve(x):
	a = [True] * (x + 1)
	sq = floor(sqrt(x))
	for i in range(3, sq + 1, 2):
		if a[i]:
			for j in range(i * i, x + 1, i):
				a[j] = False
	if x > 1:
		p = [2]
	else:
		p = []
	for i in range(3, x + 1, 2):
		if a[i]:
			p.append(i)
	return p

def prime_factor(x):
	c = 1
	i = 0
	while p[i] * p[i] <= x:
		if not x % p[i]:
			c += 1
			while not x % p[i]:
				x //= p[i]
		i += 1
	if x > 1:
		c += 1
	return c
for _ in range(ii()):
	(a, b) = mi()
	if a == b:
		f = 0
	elif a > b and (not (a - b) % 2) or (a < b and (a - b) % 2):
		f = 1
	else:
		f = 2
	print(f)


n = int(input())
arr = []
cnt = []
for i in range(n):
	temp_str = input()
	fin = [int(temp_str.split(' ')[0]), int(temp_str.split(' ')[1])]
	arr.append(fin)
for i in range(n):
	move_a = abs(arr[i][0] - arr[i][1]) / 10
	if move_a > int(move_a):
		cnt.append(int(move_a) + 1)
	else:
		cnt.append(int(move_a))
for i in range(n):
	print(cnt[i])


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2
from bisect import bisect_right, bisect_left
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factorial(n):
	if n == 0:
		return 1
	return n * factorial(n - 1)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return len(set(factors))

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def DFS(root, g, vis, ans):
	vis[root] = 1
	for c in g[root]:
		if vis[c] == 0:
			ans.append(c)
			DFS(c, g, vis, ans)
MOD = 1000000007
PMOD = 998244353
T = 1
T = int(stdin.readline())
for _ in range(T):
	(a, b) = list(map(int, stdin.readline().rstrip().split()))
	if a == b:
		print(0)
		continue
	if a > b and (a - b) % 2 == 0 or (a < b and (b - a) % 2 == 1):
		print(1)
	else:
		print(2)


n = int(input())
s = [list(map(int, input().split())) for i in range(n)]
for l in s:
	t = abs(l[1] - l[0])
	resp = t // 10
	if t % 10 != 0:
		resp += 1
	print(resp)


t = int(input())
output = []
for i in range(t):
	a = list(map(int, input().split()))
	if abs(int(a[0] - a[1])) % 10 == 0:
		output.append(abs(int((a[0] - a[1]) / 10)))
	else:
		output.append(abs(int((a[0] - a[1]) / 10)) + 1)
for i in output:
	print(i)


from math import ceil
t = int(input())
while t:
	(a, b) = [int(i) for i in input().split()]
	x = abs(a - b)
	print(ceil(x / 10))
	t -= 1


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print((max(a, b) - min(a, b) + 9) // 10)


lask = int(input())
for i in range(lask):
	s = input().split(' ')
	s = [int(x) for x in s]
	sum1 = (abs(s[0] - s[1]) + 10 - 1) // 10
	print(sum1)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
sys.setrecursionlimit(100000000)
ii = lambda : int(input())
si = lambda : input()
jn = lambda x, l: x.join(map(str, l))
sl = lambda : list(map(str, input().strip()))
mi = lambda : map(int, input().split())
mif = lambda : map(float, input().split())
lii = lambda : list(map(int, input().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
mod = 1000000007
for _ in range(ii()):
	(a, b) = mi()
	x = b - a
	sol = abs(x) // 10
	if abs(x) % 10 == 0:
		print(sol)
	else:
		print(sol + 1)


def twoIntProb(a, b):
	if a > b:
		n = a - b
	elif a == b:
		return 0
	elif a < b:
		n = b - a
	store = 0
	while n > 0:
		if n >= 10:
			store = store + n // 10
			n = n % 10
		else:
			store = store + 1
			n = n % 10
			break
	return store
t = int(input())
while t > 0:
	store = input()
	(a, b) = store.split(' ')
	a = int(a)
	b = int(b)
	print(twoIntProb(a, b))
	t = t - 1


n = int(input())
langs = {'po': 'FILIPINO', 'desu': 'JAPANESE', 'masu': 'JAPANESE', 'mnida': 'KOREAN'}
res = []
for i in range(n):
	(a, b) = list(map(lambda x: int(x), input().split()))
	dif = a - b
	ans = abs(dif) / 10
	if ans > int(ans):
		ans = int(ans) + 1
	res.append(int(ans))
for w in res:
	print(w)


def f(a, b):
	if b > a:
		res = abs(b - a)
		if res == 0:
			return 0
		elif res % 2 == 1:
			return 1
		else:
			return 2
	else:
		res = abs(b - a)
		if res == 0:
			return 0
		elif res % 2 == 0:
			return 1
		else:
			return 2
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	print(f(a, b))


import sys
for _ in range(int(sys.stdin.readline().rstrip())):
	(a, b) = list(map(int, sys.stdin.readline().rstrip().split()))
	if a == b:
		print('0')
	elif a < b:
		if (b - a) % 2 == 1:
			print('1')
		else:
			print('2')
	elif (a - b) % 2 == 1:
		print('2')
	else:
		print('1')


z = int(input())
i = 0
while i < z:
	(a, b) = map(int, input().split())
	s = max(a, b) - min(a, b)
	if s != 0:
		d = (s + 9) // 10
	else:
		d = 0
	print(d)
	i += 1


def get_ans(a, b):
	if a == b:
		return 0
	elif a > b and (a - b) % 2 == 0:
		return 1
	elif a > b and (a - b) % 2 != 0:
		return 2
	elif b > a and (b - a) % 2 != 0:
		return 1
	else:
		return 2
t = int(input(''))
list = []
for i in range(t):
	(a, b) = [int(x) for x in input('').split(' ')]
	list.append(get_ans(a, b))
for i in list:
	print(i)


for _ in range(int(input())):
	[a, b] = [int(i) for i in input().split()]
	x = b - a
	n = 10
	count = 0
	neg = False
	if x < 0:
		neg = True
		x = x * -1
	while x != 0 and n != 0:
		if x >= n:
			count += int(x / n)
			break
		else:
			n -= 1
	if x % n == 0:
		print(count)
	else:
		print(count + 1)


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


t = int(input())

def add_sub(a, b):
	if a > b:
		if (a - b) % 2 != 0:
			return 2
		else:
			return 1
	elif a < b:
		if (b - a) % 2 != 0:
			return 1
		else:
			return 2
	else:
		return 0
answer = []
for i in range(t):
	(a, b) = map(int, input().split())
	answer.append(add_sub(a, b))
for i in range(t):
	print(answer[i])


TC = int(input())
for tc in range(TC):
	(A, B) = map(int, input().split())
	result = -1
	if A > B:
		(a, b) = divmod(A - B, 10)
		result = a
		if b > 0:
			result += 1
	else:
		(a, b) = divmod(B - A, 10)
		result = a
		if b > 0:
			result += 1
	print(result)


import math

def read_int() -> int:
	return int(input())

def read_ints():
	return map(int, input().split(' '))

def test_case():
	(a, b) = read_ints()
	if a >= b:
		print(math.ceil((a - b) / 10))
	else:
		print(math.ceil((b - a) / 10))
tests = read_int()
for _ in range(tests):
	test_case()


N = int(input())
x = [list(map(int, input().split())) for _ in range(N)]
for i in range(N):
	ans = -(-abs(x[i][1] - x[i][0]) // 10)
	print(ans)


n = input('')
t = int(n)
i = 0
answer = list()
while i < t:
	ans = 0
	c = input('')
	(e, f) = c.split()
	a = int(e)
	b = int(f)
	if a == b:
		ans = 0
	if a > b:
		if (a - b) % 2 == 0:
			ans = 1
		if (a - b) % 2 == 1:
			ans = 2
	if b > a:
		if (a - b) % 2 == 1:
			ans = 1
		if (a - b) % 2 == 0:
			ans = 2
	answer.append(ans)
	i = i + 1
for i in range(len(answer)):
	print(answer[i])


import sys, math
import io, os
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter

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

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write('\n'.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
from decimal import Decimal
mod = int(1000000000.0) + 7
INF = 2 ** 32
for t in range(int(data())):
	(a, b) = mdata()
	ans = 0
	if abs(a - b) % 10 != 0:
		ans = 1
	out(abs(a - b) // 10 + ans)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in 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):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True

def main():
	for i in range(ii()):
		(a, b) = mi()
		if a < b:
			(a, b) = (b, a)
		c = (a - b) // 10
		if (a - b) % 10 != 0:
			print(c + 1)
		else:
			print(c)
main()


test_cases = int(input())
for case in range(test_cases):
	(a, b) = map(int, input().split())
	if a == b:
		print('0')
	elif abs(a - b) <= 10:
		print('1')
	else:
		moves = abs(a - b) / 10
		remainder = abs(a - b) % 10
		if remainder == 0:
			print('%d' % moves)
		else:
			moves += 1
			print('%d' % moves)


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

class Solution:

	def main(self, a, b):
		df = abs(a - b)
		return math.ceil(df / 10)
t = inp()
Solution = Solution()
for _ in range(t):
	(a, b) = inlt()
	res = Solution.main(a, b)
	print(res)


n = int(input())
for i in range(n):
	m = list(map(int, input().split()))
	x = m[0] - m[1]
	if x > 0:
		if x % 2 == 0:
			print(1)
		else:
			print(2)
	if x < 0:
		if x % 2 == 0:
			print(2)
		else:
			print(1)
	if x == 0:
		print(0)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	d = abs(b - a)
	dm = d % 10
	d -= dm
	ans = d // 10
	if dm > 0:
		ans += 1
	print(ans)


q = int(input())
for i in range(q):
	n = input().split()
	a = int(n[0])
	b = int(n[1])
	d = b - a
	if d > 0:
		if d % 2 == 0:
			ans = 2
		else:
			ans = 1
	elif d < 0:
		if d % 2 == 0:
			ans = 1
		else:
			ans = 2
	else:
		ans = 0
	print(ans)


for test in range(int(input())):
	(n, m) = map(int, input().split())
	if n == m:
		print(0)
	elif n > m and n % 2 == m % 2:
		print(1)
	elif n < m and n % 2 != m % 2:
		print(1)
	else:
		print(2)


t = int(input())
for i in range(t):
	a = []
	a = [int(a) for a in input().split()]
	x = max(a)
	y = min(a)
	count = 0
	if x - y == 0:
		print('0')
	else:
		count = (x - y) // 10
		if x - count * 10 - y <= 9 and x - count * 10 - y > 0:
			count = count + 1
		print(count)


def func(ab):
	(a, b) = list(map(int, ab.split()))
	if a == b:
		return 0
	if a < b:
		if (b - a) % 2 == 0:
			return 2
		return 1
	if (a - b) % 2 == 0:
		return 1
	return 2

def main():
	for i in map(func, [input() for i in range(int(input()))]):
		print(i)
main()


def iin():
	return int(input())

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

def main():
	t = iin()
	while t:
		t -= 1
		(a, b) = lin()
		print((abs(a - b) + 9) // 10)
main()


t = int(input())
for i in range(t):
	(a, b) = [int(j) for j in input().split()]
	diff = abs(a - b)
	ans = diff / 10
	if diff % 10:
		ans += 1
	print(int(ans))


out = []
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = a - b if a >= b else b - a
	out.append(str((c + 9) // 10))
print('\n'.join(out))


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
for _ in range(int(input().rstrip())):
	(a, b) = map(int, input().split())
	t = abs(a - b)
	if t >= 10:
		if t % 10:
			print(t // 10 + 1)
		else:
			print(t // 10)
	elif a != b:
		print(1)
	else:
		print(0)


import math
for t in range(int(input())):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	sub = abs(a - b)
	ans = math.ceil(sub / 10)
	print(ans)


from copy import copy

def get_int():
	return int(input())

def get_ints():
	return [int(item) for item in input().split(' ')]

def get_str():
	return input()

def get_strs():
	return input().split(' ')

def main():
	t = get_int()
	for _ in range(t):
		(a, b) = get_ints()
		(res1, res2) = (abs(a - b) / 10, abs(a - b) // 10)
		print(res2 if res1 == res2 else res2 + 1)
main()


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(cou):
		(a, b) = [int(x) for x in input().split()]
		if a == b:
			yield 0
		elif b > a:
			if abs(a - b) % 2 == 0:
				yield 2
			else:
				yield 1
		elif abs(a - b) % 2 == 0:
			yield 1
		else:
			yield 2
cou = int(input())
ans = gift()
print(*ans, sep='\n')


n = int(input())
tests = [input() for _ in range(n)]
for test in tests:
	(a, b) = [int(x) for x in test.split(' ')]
	count = 0
	while True:
		if a == b:
			print(count)
			break
		else:
			diff = a - b
			tens = abs(diff / 10)
			if tens.is_integer():
				count += tens
			else:
				count += int(tens) + 1
			print(int(count))
			break


T = int(input())
for _ in range(T):
	(a, b) = [int(x) for x in input().split(' ')]
	diff = abs(a - b)
	print(diff // 10 + (diff % 10 != 0))


n = int(input())
for i in range(n):
	a = list(map(int, input().split(' ')))
	d = abs(a[1] - a[0])
	c1 = 0
	c = d / 10
	sum = 0
	e = d // 10
	x = d - 10 * e
	if d == 0:
		print(0)
	else:
		i = 10
		while i >= 1:
			if c > 0:
				sum = x - i
				if sum >= 0:
					c1 += 1
					x = sum
			if c < 0:
				sum = d - i
				c1 += 1
			if sum == 0 or d == 0:
				break
			i -= 1
		print(c1 + e)


for test in range(0, int(input())):
	arr = [int(x) for x in input().split()]
	(a, b) = (arr[0], arr[1])
	if ((b - a) / 10).is_integer():
		print(abs(b - a) // 10)
	else:
		print(abs(b - a) // 10 + 1)


def input_int():
	return int(input())

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

def input_int_map():
	return map(int, input().split())

def run():
	q_num = input_int()
	for i in range(q_num):
		(a, b) = input_int_map()
		diff = max(a, b) - min(a, b)
		diff_count = diff // 10
		if diff % 10 > 0:
			diff_count += 1
		print(diff_count)
run()


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	cnt = 0
	if a == b:
		print(0)
		continue
	while a != b:
		if a > b:
			a -= (a - b + 1) // 2 * 2
			cnt += 1
		if a < b:
			a += (b - a) // 2 * 2 + 1
			cnt += 1
	print(min(2, cnt))


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2
from bisect import bisect_right, bisect_left
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factorial(n):
	if n == 0:
		return 1
	return n * factorial(n - 1)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def sumDigits(no):
	return 0 if no == 0 else int(no % 10) + sumDigits(int(no / 10))
MOD = 1000000007
PMOD = 998244353
N = 10 ** 5
T = 1
T = int(stdin.readline())
for _ in range(T):
	(a, b) = list(map(int, stdin.readline().rstrip().split()))
	ans = abs(a - b)
	if ans % 10 == 0:
		print(ans // 10)
	else:
		print(ans // 10 + 1)


def is_same_parity(a, b):
	return (a + b) % 2 == 0

def required_operations(a, b):
	if a == b:
		return 0
	same_parity = is_same_parity(a, b)
	if b > a:
		return 2 if same_parity else 1
	return 1 if same_parity else 2
tests_number = int(input())
for _ in range(tests_number):
	(a, b) = map(int, input().split())
	print(required_operations(a, b))


n = int(input())
for i in range(n):
	s = list(map(int, input().split()))
	if s[1] > s[0]:
		d = s[1] - s[0]
		if d % 2 == 0:
			print(2)
		else:
			print(1)
	elif s[0] > s[1]:
		d = s[0] - s[1]
		if d % 2 == 0:
			print(1)
		else:
			print(2)
	elif s[0] == s[1]:
		print(0)


import math
from decimal import Decimal
import heapq
import copy
import heapq
from collections import deque
from collections import defaultdict
MOD = 1000000007

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def da():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	return (n, m, a)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def fact(n):
	tc = []
	ans = {}
	d = 2
	while d * d <= n:
		if n % d == 0:
			tc.append(d)
			n //= d
		else:
			d += 1
	if n > 1:
		tc.append(n)
	for i in tc:
		ans[i] = ans.get(i, 0) + 1
	return ans

def to_zero(n, s):
	lst = s[0]
	ans = []
	for i in range(n):
		if lst == s[i]:
			continue
		elif lst == '0':
			lst = '1'
			ans.append(i)
		else:
			lst = '0'
			ans.append(i)
	if lst == '1':
		ans.append(n)
	return ans
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	k = 0
	b -= a
	while b > 0:
		for i in range(10, 0, -1):
			if b >= i:
				d = b // i
				k += d
				b -= d * i
				break
	print(k)


t = int(input())
for each in range(t):
	(a, b) = map(int, input().split())
	res = 0
	dif = abs(a - b)
	if dif % 10 == 0:
		print(dif // 10)
	else:
		print(dif // 10 + 1)


T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	if a <= b:
		if (b - a) % 10 != 0:
			ans = (b - a) // 10 + 1
		else:
			ans = (b - a) // 10
	elif (a - b) % 10 != 0:
		ans = (a - b) // 10 + 1
	else:
		ans = (a - b) // 10
	print(ans)


def addEven(arr):
	(a, b) = (arr[0], arr[1])
	c = 0
	if a == b:
		return 0
	elif a > b:
		if (a - b) % 2 == 0:
			c += 1
		else:
			c += 2
	elif (a - b) % 2 == 0:
		c += 2
	else:
		c += 1
	return c
tc = int(input())
for i in range(tc):
	np = list(map(int, input().split()))
	print(addEven(np))


def solve(x: int, y: int) -> int:
	diff = abs(y - x)
	if diff % 10 == 0:
		return diff // 10
	return diff // 10 + 1
t = int(input())
while t:
	(a, b) = map(int, input().split(' '))
	print(solve(a, b))
	t -= 1


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	c = a - b
	if c > 0 and c & 1 == 0:
		print('1')
	elif c > 0 and c & 1 == 1:
		print('2')
	elif c == 0:
		print('0')
	elif c < 0 and abs(c) & 1 == 0:
		print('2')
	elif c < 0 and abs(c) & 1 == 1:
		print('1')


amount = int(input())
for _ in range(amount):
	nums = [*map(int, input().split())]
	goal = max(nums) - min(nums)
	times = 0
	for i in range(10, 0, -1):
		times += goal // i
		goal %= i
	print(times)


import sys, math
try:
	(sys.stdin, sys.stdout) = (open('input.txt', 'r'), open('out.txt', 'w'))
except:
	pass
from sys import stdin, stdout
mod = int(1000000000.0 + 7)
from statistics import mode
from collections import *
from math import ceil, floor, inf, factorial, gcd, log2, sqrt, log
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()

def lcm(a, b):
	return a * b // gcd(a, b)

def setbits(n):
	return bin(n).count('1')

def resetbits(n):
	return bin(n).count('0')

def modinv(n, p):
	return pow(n, p - 2, p)

def ncr(n, r):
	(num, den) = (1, 1)
	r = min(n, n - r)
	for i in range(r):
		num *= n - i
		den *= i + 1
	return num // den

def ncr_p(n, r, p):
	(num, den) = (1, 1)
	r = min(r, n - r)
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * modinv(den, p) % p

def isPrime(num):
	if num <= 1:
		return False
	if num == 2 or n == 3:
		return True
	if num % 2 == 0 or num % 3 == 0:
		return False
	m = int(num ** 0.5) + 1
	for i in range(5, m, 6):
		if num % i == 0 or num % (i + 2) == 0:
			return False
	return True

def bin_search(s, low, high, val):
	while low <= high:
		mid = low + (high - low) // 2
		if s[mid] == val:
			return mid
		elif s[mid] < val:
			low = mid + 1
		else:
			high = mid - 1
	return -1

def sumofdigit(num):
	count = 0
	while num:
		count += num % 10
		num //= 10
	return count

def inputmatrix():
	(r, c) = iia()
	mat = [0] * r
	for i in range(r):
		mat[i] = iia()
	return (r, c, mat)

def prefix_sum(n, s):
	for i in range(1, n):
		s[i] += s[i - 1]
	return s

def binomial(n, k):
	if 0 <= k <= n:
		ntok = 1
		ktok = 1
		for t in range(1, min(k, n - k) + 1):
			ntok *= n
			ktok *= t
			n -= 1
		return ntok // ktok
	else:
		return 0

def divisors(n):
	res = []
	for i in range(1, ceil(sqrt(n)) + 1):
		if n % i == 0:
			if i == n // i:
				res.append(i)
			else:
				res.append(i)
				res.append(n // i)
	return res
for _ in range(ii1()):
	(a, b) = iia()
	if a == b:
		print(0)
	elif abs(b - a) <= 10:
		print(1)
	else:
		ans = abs(a - b) // 10
		if abs(a - b) % 10 == 0:
			print(ans)
		else:
			print(ans + 1)


n = int(input())
for i in range(n):
	num = list(map(int, input().split()))
	diff = abs(num[0] - num[1])
	counter = 0
	if diff != 0:
		if num[0] > num[1]:
			if diff % 2 == 0:
				counter = 1
			else:
				counter = 2
		elif diff % 2 == 0:
			counter = 2
		else:
			counter = 1
	print(counter)


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
from itertools import accumulate

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

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

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

def dtob(n):
	return bin(n).replace('0b', '')

def btod(n):
	return int(n, 2)

def common(l1, l2):
	return set(l1).intersection(l2)

def solution():
	for _ in range(Int()):
		(a, b) = Mint()
		mi = min(a, b)
		ma = max(a, b)
		ans = ma - mi
		print(ceil(ans / 10))
solution()


import math
s = int(input())
for i in range(s):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	print(math.ceil(x / 10))


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


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().strip().split())
	c = abs(b - a) // 10
	print(c + int((b - a) % 10 != 0))


def solve(a, b):
	if a == b:
		return 0
	if a < b and (b - a) % 2 == 1:
		return 1
	if a > b and (a - b) % 2 == 0:
		return 1
	return 2
n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	r = solve(a, b)
	print(r)


R = lambda : map(int, input().split())
(t,) = R()
for _ in range(t):
	(a, b) = R()
	x = abs(b - a)
	ans = x // 10
	if x % 10 != 0:
		ans += 1
	print(ans)


for i in range(int(input())):
	(x, y) = map(int, input().split(' '))
	if x < y:
		(x, y) = (y, x)
	count = 0
	count += (x - y) // 10
	if (x - y) % 10 != 0:
		count += 1
	print(count)


import sys
input = sys.stdin.readline

def main():
	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 & 1:
				print(2)
			else:
				print(1)
		elif B - A & 1:
			print(1)
		else:
			print(2)
main()


def up(n):
	if n == int(n):
		return int(n)
	return int(n + 1)
n = int(input())
for i in range(n):
	nkt = input().split()
	a = int(nkt[0])
	b = int(nkt[1])
	print(up(abs(b - a) / 10))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	cnt = 0
	while a != b:
		if a > b:
			if a - b >= 10:
				cnt += (a - b) // 10
				a -= (a - b) // 10 * 10
			else:
				cnt += 1
				break
		elif b - a >= 10:
			cnt += (b - a) // 10
			a += (b - a) // 10 * 10
		else:
			cnt += 1
			break
	print(cnt)


def farr(s):
	all_freq = {}
	for i in s:
		if i in all_freq:
			all_freq[i] += 1
		else:
			all_freq[i] = 1
	return all_freq

def nextInt():
	return int(input())

def intArr():
	arr = input().split(' ')
	return [int(x) for x in arr]

def op(arr, l):
	arr.sort()
	d = arr[l - 1]
	for i in range(0, l):
		arr[i] = d - arr[i]
	return
t = nextInt()
ans = []
for tt in range(t):
	arr = intArr()
	n1 = arr[0]
	n2 = arr[1]
	if n1 == n2:
		ans.append(0)
	else:
		if n1 > n2:
			dif = n1 - n2
		else:
			dif = n2 - n1
		if dif % 10 == 0:
			ans.append(int(dif / 10))
		else:
			s = int(str(dif)[len(str(dif)) - 1])
			dif -= s
			ans.append(1 + int(dif / 10))
for x in ans:
	print(x)


t = int(input())
for i in range(t):
	(b, d) = map(int, input().split())
	if b == d:
		print(0)
	elif abs(b - d) % 10 >= 1:
		print(abs(b - d) // 10 + 1)
	else:
		print(abs(b - d) // 10)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	count = 0
	if n <= k:
		s = (k - n) // 10
		if (k - n) % 10 != 0:
			count = count + 1
		print(count + s)
	else:
		s = (n - k) // 10
		if (n - k) % 10 != 0:
			count = count + 1
		print(count + s)


n = int(input())
for i in range(n):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if b > a:
		d = b - a
		d = d / 10
		if d.is_integer():
			print(int(d))
		else:
			print(int(d + 1))
	elif a > b:
		d = a - b
		d = d / 10
		if d.is_integer():
			print(int(d))
		else:
			print(int(d + 1))
	elif a == b:
		print(0)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	ans = 0
	ans = c // 10
	c = c % 10
	ans = ans + c // 9
	c = c % 9
	ans = ans + c // 8
	c = c % 8
	ans = ans + c // 7
	c = c % 7
	ans = ans + c // 6
	c = c % 6
	ans = ans + c // 5
	c = c % 5
	ans = ans + c // 4
	c = c % 4
	ans = ans + c // 3
	c = c % 3
	ans = ans + c // 2
	c = c % 2
	ans = ans + c
	print(ans)


test_cases = int(input())
outputs = []
for i in range(test_cases):
	(a, b) = map(int, input().split())
	if b == a:
		outputs.append('0')
	elif b > a and (b - a) % 2 != 0:
		outputs.append('1')
	elif a > b and (a - b) % 2 == 0:
		outputs.append('1')
	else:
		outputs.append('2')
print('\n'.join(outputs))


t = int(input())
for tc in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	c = 0
	e = 0
	c = (b - a) // 10
	a = a + 10 * c
	while b - a > 10:
		e += (b - a) // 10
		a = a + e * 10
		c = c + e
	if b - a == 0:
		print(c)
	else:
		print(c + 1)


from math import gcd
from bisect import bisect_left, bisect_right
from itertools import combinations
from itertools import permutations
from bisect import bisect_left
from math import ceil
from math import radians
from heapq import heapify, heappush, heappop
import bisect
from math import pi
from collections import deque
from math import factorial
from math import log, ceil
from collections import defaultdict
from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction
mod = int(pow(10, 9) + 7)

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li1():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d:
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d:
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0 and i % 2 == 1:
			s.add(i)
			n = n // i
	if n > 2 and n % 2 == 1:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')

def binsearch(a, l, r, x):
	while l <= r:
		mid = l + (r - 1) // 2
		if a[mid]:
			return mid
		elif a[mid] > x:
			l = mid - 1
		else:
			r = mid + 1
	return -1

def readTree(n):
	adj = [set() for _ in range(n)]
	for _ in range(n - 1):
		(u, v) = map(int, input().split())
		adj[u - 1].add(v - 1)
		adj[v - 1].add(u - 1)
	return adj

def treeOrderByDepth(n, adj, root=0):
	parent = [-2] + [-1] * (n - 1)
	ordered = []
	q = deque()
	q.append(root)
	depth = [0] * n
	while q:
		c = q.popleft()
		ordered.append(c)
		for a in adj[c]:
			if parent[a] == -1:
				parent[a] = c
				depth[a] = depth[c] + 1
				q.append(a)
	return (ordered, parent, depth)

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def nextPowerOf2(n):
	count = 0
	if n and (not n & n - 1):
		return n
	while n != 0:
		n >>= 1
		count += 1
	return 1 << count

def cou(n):
	c = 0
	while n > 1:
		c += 1
		n //= 2
	return c

def sortsec(l):
	return sorted(l, key=lambda x: x[1])

def BinarySearch(a, x):
	i = bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def subarray(A):
	r = set()
	p = {0}
	for x in A:
		p = {x | y for y in p} | {x}
		r |= p
	return len(r)
for _ in range(ii()):
	(a, b) = mi()
	print(int(ceil(abs(b - a) / 10)))


from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')
file = 1

def solve():
	for _ in range(ii()):
		(a, b) = mi()
		x = abs(a - b)
		print(ceil(x / 10))
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


for k in range(int(input(''))):
	l = [int(x) for x in input('').split()]
	a = max(l)
	b = min(l)
	if a == b:
		print(0)
	elif a - b <= 10 and a - b > 0:
		print(1)
	elif int((a - b) / 10) == (a - b) / 10:
		print((a - b) // 10)
	else:
		print(int((a - b) // 10) + 1)


from math import ceil
testcase = int(input())
for i in range(testcase):
	k = 10
	count = 0
	n = 0
	(a, b) = list(map(int, input().split()))
	if a == b:
		print(count)
	else:
		if a > b:
			max = a
			min = b
			diff = a - b
		else:
			max = b
			min = a
			diff = b - a
		count = diff // 10
		if diff % 10 != 0:
			count += 1
		print(count)


def count(a, b):
	if a == b:
		return 0
	if a > b:
		k = a - b
		if k <= 10:
			return 1
		else:
			power = k // 10
			if k % 10 == 0:
				return power
			return power + 1
	else:
		k = b - a
		if k <= 10:
			return 1
		else:
			power = k // 10
			if k % 10 == 0:
				return power
			return power + 1
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().rstrip().split())
	print(count(a, b))


t = int(input(''))
while t:
	elements = input('')
	elements = elements.split()
	lst = []
	for element in elements:
		lst.append(int(element))
	k = abs(lst[0] - lst[1])
	count = k // 10
	if k % 10 != 0:
		count += 1
	print(count)
	t -= 1


for tt in range(int(input())):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	r = x // 10
	if x % 10 != 0:
		r += 1
	print(r)


for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	(a, b) = (min(a, b), max(a, b))
	ans = b - a
	k = 10
	count = 0
	while ans > 0 and k >= 1:
		count += ans // k
		ans = ans % k
		k -= 1
	print(count)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if n == k:
		print('0')
	elif n < k:
		if n % 2 == k % 2:
			print('2')
		else:
			print('1')
	elif n % 2 == k % 2:
		print('1')
	else:
		print('2')


t = int(input())
for j in range(t):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	if diff <= 10 and diff != 0:
		print(1)
	elif diff <= 10 and diff == 0:
		print(0)
	else:
		count = 0
		i = 10
		while i >= 1:
			count = count + diff // i
			diff = diff % i
			if diff == 0:
				break
			i -= 1
		print(count)


t = int(input())
kt = 0
min_k = []
while kt < t:
	kt += 1
	(a, b) = input().split()
	a_b = abs(int(a) - int(b))
	if a_b % 10 == 0:
		min_k.append(a_b // 10)
	else:
		min_k.append(a_b // 10 + 1)
for k in min_k:
	print(k)


t = int(input())
while t:
	t = t - 1
	(a, b) = map(int, input().split())
	if a == b:
		print('0')
		continue
	if a > b:
		temp = a - b
	else:
		temp = b - a
	ans = 0
	if temp % 10 != 0:
		ans = ans + 1
		temp = temp - temp % 10
	ans = ans + temp // 10
	print(ans)


t = int(input())

def find(x, y):
	if x == y:
		return 0
	elif x > y:
		if (x - y) % 2:
			return 2
		else:
			return 1
	elif (y - x) % 2:
		return 1
	else:
		return 2
for i in range(t):
	(x, y) = map(int, input().split())
	print(find(x, y))


import sys
import math
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')
for T in range(int(input())):
	(a, b) = map(int, input().split())
	ans = 0
	if a < b:
		ans = (b - a) / 10
	elif a > b:
		ans = (a - b) / 10
	ans = math.ceil(ans)
	ans = int(ans)
	print(ans)


class Solution:

	def solve(self, a, b):
		if a == b:
			return 0
		if a < b and a & 1 ^ b & 1:
			return 1
		elif a > b and (not a & 1 ^ b & 1):
			return 1
		else:
			return 2
sol = Solution()
t = int(input().strip())
for i in range(t):
	[a, b] = list(map(int, input().strip().split()))
	print(sol.solve(a, b))


ar = []
for i in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	if abs(a - b) > 10 and abs(a - b) % 10 != 0:
		ar.append(abs(a - b) // 10 + 1)
	elif abs(a - b) < 10 and abs(a - b) != 0:
		ar.append(1)
	else:
		ar.append(abs(a - b) // 10)
for ans in ar:
	print(ans)


from math import ceil
t = int(input())
for _ in range(t):
	(x, y) = map(int, input().strip().split())
	if x > y:
		(x, y) = (y, x)
	print(ceil((y - x) / 10))


import math
for x in range(int(input())):
	(h, m) = list(map(int, input().split()))
	print(math.ceil(abs((h - m) / 10)))


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	c = a - b
	if c == 0:
		print(c)
	elif a > b:
		p = a - b
		d = p / 10
		e = int(d)
		if d > e:
			print(e + 1)
		else:
			print(e)
	else:
		q = b - a
		f = q / 10
		g = int(f)
		if f > g:
			print(g + 1)
		else:
			print(g)


ans = []
for it in range(int(input())):
	(a, b) = map(int, input().split())
	tmp = abs(b - a)
	if tmp % 10:
		ans += [tmp // 10 + 1]
	else:
		ans += [tmp // 10]
print(*ans, sep='\n')


T = int(input())
for t in range(T):
	line = input().split(' ')
	(a, b) = (int(line[0]), int(line[1]))
	diff = abs(a - b)
	if diff % 10 == 0:
		print(diff // 10)
	else:
		print(diff // 10 + 1)


t = int(input())
for i in range(t):
	c = input()
	(a, b) = c.split(' ')
	if int(a) > int(b):
		print(f'{(int(a) - int(b)) // 10 + int((int(a) - int(b)) % 10 != 0)}')
	else:
		print(f'{(int(b) - int(a)) // 10 + int((int(b) - int(a)) % 10 != 0)}')


t = int(input())
import math
while t != 0:
	t -= 1
	(n, p) = map(int, input().split())
	if n == p:
		print('0')
	elif n < p:
		if p - n <= 10:
			print('1')
		else:
			print(int(math.ceil((p - n) / 10)))
	elif n - p <= 10:
		print('1')
	else:
		print(int(math.ceil((n - p) / 10)))


import math
import os
import random
import re
import sys
from collections import defaultdict, Counter, deque
import heapq
from functools import lru_cache
from itertools import accumulate, chain, combinations, permutations, groupby, zip_longest
from math import floor, ceil, sqrt
t = int(input())
res = []
for _ in range(t):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	res += (diff // 10 + int(diff % 10 > 0),)
for v in res:
	print(v)


t = int(input())
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	t = max(a, b)
	b = a + b - t
	s = (t - b) // 10
	if (t - b) % 10 > 0:
		s = s + 1
	print(s)


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007
for t in range(I()):
	(a, b) = In()
	x = b - a
	if x == 0:
		print(0)
	elif x > 0:
		if x % 2 == 0:
			print(2)
		else:
			print(1)
	elif abs(x) % 2 == 0:
		print(1)
	else:
		print(2)


import sys, math
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		c = max(a, b) - min(a, b)
		ans = c // 10
		if c % 10 != 0:
			ans += 1
		print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	diff = a - b if a > b else b - a
	tmp1 = diff // 10
	tmp = diff % 10
	if diff % 10 == 0:
		tmp = 0
	else:
		tmp = 1
	res = tmp1 + tmp
	print(res)


for n in [*open(0)][1:]:
	(p, q) = map(int, n.split())
	print(0 - -abs(p - q) // 10)


import sys
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random

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=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

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 flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

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 prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
ans = []
for _ in range(ii()):
	(a, b) = mi()
	ans.append(ceil(abs(a - b), 10))
prr(ans, '\n')


def solution(a, b):
	(a, b) = (min(a, b), max(a, b))
	val = b - a
	return (val + 9) // 10
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(solution(a, b))


n = int(input())
for i in range(n):
	(a, b) = [int(num) for num in input().split()]
	print((abs(a - b) + 9) // 10 % 1000000007)


import sys
input = sys.stdin.readline
for j in range(int(input())):
	(a, b) = map(int, input().split(' '))
	if a == b:
		print(0)
	elif b < a and (b - a) % 2 == 0 or (b > a and (b - a) % 2 == 1):
		print(1)
	else:
		print(2)


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	if a > b or a < b:
		x = abs(a - b)
		moves = 0
		while x != 0:
			if x >= 10:
				moves = x // 10
				x = x % 10
			elif x >= 9 and x < 10:
				moves += 1
				x -= 9
			elif x >= 8 and x < 9:
				moves += 1
				x -= 8
			elif x >= 7 and x < 8:
				moves += 1
				x -= 7
			elif x >= 6 and x < 7:
				moves += 1
				x -= 6
			elif x >= 5 and x < 6:
				moves += 1
				x -= 5
			elif x >= 4 and x < 5:
				moves += 1
				x -= 4
			elif x >= 3 and x < 4:
				moves += 1
				x -= 3
			elif x >= 2 and x < 3:
				moves += 1
				x -= 2
			elif x >= 1 and x < 2:
				moves += 1
				x -= 1
		print(moves)
	else:
		print(0)


import sys
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))

def main():
	for _ in range(int(input())):
		(a, b) = read()
		print(abs(b - a) // 10 + (abs(a - b) % 10 > 0))
main()


import sys
N = int(sys.stdin.readline())
for _ in range(N):
	l = sys.stdin.readline().split()
	a = int(l[0])
	b = int(l[1])
	if a == b:
		print(0)
		continue
	if a > b:
		reste = a - b
		if reste % 2 == 0:
			print(1)
			continue
		else:
			print(2)
			continue
	if a < b:
		reste = b - a
		if reste % 2 == 0:
			print(2)
		else:
			print(1)


from math import *
t = int(input())
for tc in range(t):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	print(f'{ceil(c / 10)}')


import sys

def swap(x, y, a):
	temp = a[x]
	a[x] = a[y]
	a[y] = temp
	return a

def solve():
	return None

def main():
	q = []
	for line in sys.stdin.readlines():
		q.append(line)
	for i in range(len(q)):
		q[i] = q[i].rstrip().split(' ')
		q[i] = [int(x) for x in q[i]]
	for i in range(1, len(q)):
		a = max(q[i][0], q[i][1])
		b = min(q[i][0], q[i][1])
		x = a - b
		if x % 10 == 0:
			print(x // 10)
		else:
			print(x // 10 + 1)
main()


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = abs(b - a)
	print((c + 9) // 10)


t = int(input())
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
for _ in range(t):
	inp = list(map(int, input().split()))
	a = inp[0]
	b = inp[1]
	m = abs(a - b)
	ans = 0
	for i in range(len(x) - 1, -1, -1):
		item = x[i]
		if m >= item:
			ans += m // item
			m = m % item
	print(ans)


t = int(input())
import math
for i in range(0, t):
	(a, b) = list(map(int, input().split()))
	p = 0
	if a > b:
		p = math.ceil((a - b) / 10)
	elif b > a:
		p = math.ceil((b - a) / 10)
	print(p)


from math import fabs
T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	if (a - b) % 10 == 0:
		print(int(fabs(a - b) // 10))
	else:
		print(int(fabs(a - b) // 10 + 1))


t = int(input())
for i in range(t):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	x = 0
	while a != b:
		d = abs(b - a)
		if a < b:
			if d >= 10:
				x += d // 10
				a += x * 10
			else:
				a += d % 10
				x += 1
		elif d >= 10:
			x += d // 10
			a -= x * 10
		else:
			a -= d % 10
			x += 1
	print(x)


import math
t = int(input())
for i in range(t):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	k = math.fabs(x - y)
	print(math.ceil(k / 10))


import math
t = int(input())
y = []
for _ in range(t):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	if x % 10 == 0:
		y.append(x // 10)
	else:
		y.append(x // 10 + 1)
for e in y:
	print(e)


import sys
import bisect
import heapq
from math import *
from collections import defaultdict as dd
from collections import deque
from collections import Counter as c
from itertools import combinations as comb
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

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

def out(var):
	sys.stdout.write(var)

def l():
	return list(map(int, data().split()))

def sl():
	return list(map(str, data().split()))

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [[val for i in range(n)] for j in range(m)]
for _ in range(int(data())):
	(a, b) = sp()
	if a == b:
		out('0\n')
	elif a < b:
		if (b - a) % 2 == 1:
			out('1\n')
		else:
			out('2\n')
	elif (a - b) % 2 == 1:
		out('2\n')
	else:
		out('1\n')


import math
import sys
from sys import *
import heapq
from collections import deque, defaultdict
from itertools import permutations, combinations, combinations_with_replacement
import random
import os
mod = 10 ** 9 + 7
MAX = sys.maxsize
MIN = -sys.maxsize - 1

def isPrime(n):
	if n > 1:
		for i in range(2, n):
			if n % i == 0:
				return False
		else:
			return True
	else:
		return False

def isPanagram(s):
	alphabet = 'abcdefghijklmnopqrstuvwxyz'
	for char in alphabet:
		if char not in s.lower():
			return False
	return True

def diff(list1):
	res = [list1[i + 1] - list1[i] for i in range(len(list1) - 1)]
	return res

def isEqual(list1):
	if len(list1) < 0:
		res = True
	res = all((ele == list1[0] for ele in list1))
	if res:
		return True
	else:
		return False

def remove_duplicate(list1):
	final_list = list(set(list1))
	return final_list

def solve():
	(a, b) = map(int, input().split())
	if a == b:
		return 0
	k = abs(a - b)
	if k % 10 == 0:
		return k // 10
	else:
		return k // 10 + 1
t = int(stdin.readline().strip())
for i in range(t):
	result = solve()
	stdout.write(str(result) + '\n')


n = int(input())
for i in range(n):
	a = list(map(int, input().split()))
	if a[0] < a[1]:
		m = (a[1] - a[0]) // 10
	else:
		m = (a[0] - a[1]) // 10
	if (a[0] - a[1]) % 10 != 0:
		m += 1
	print(m)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = 0
	if a == b:
		print(0)
	else:
		d = abs(a - b)
		if d in range(1, 11):
			print(1)
		elif d % 10 == 0:
			print(d // 10)
		else:
			print(d // 10 + 1)


import sys, os
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
input = lambda : sys.stdin.readline().strip()
li = lambda : list(map(int, input().split()))
I = lambda : int(input())
for _ in range(I()):
	(a, b) = li()
	if abs(a - b) % 10 == 0:
		print(abs(a - b) // 10)
	else:
		print(abs(a - b) // 10 + 1)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	total = 0
	if a < b:
		u = b - a
	else:
		u = a - b
	c = 10
	while u != 0:
		b = divmod(u, c)
		total += b[0]
		u = b[1]
		c -= 1
		if c > u:
			c = u
	print(total)


t = int(input())
A = []
for i in range(t):
	(a, b) = (int(y) for y in input().split())
	if a > b and (a - b) % 10 == 0:
		A.append(int((a - b) / 10))
	elif a > b and (a - b) % 10 != 0:
		A.append(int((a - b) / 10) + 1)
	elif a < b and (b - a) % 10 == 0:
		A.append(int((b - a) / 10))
	elif a < b and (b - a) % 10 != 0:
		A.append(int((b - a) / 10) + 1)
	else:
		A.append(0)
for j in A:
	print(j)


from math import floor
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	k = 0
	n = 0
	c = 0
	if b > a:
		while a != b:
			if b - a >= 10:
				c = floor((b - a) // 10)
				b -= c * 10
				n += c
			else:
				a = b
				n += 1
	elif b < a:
		while b != a:
			if a - b >= 10:
				c = floor((a - b) // 10)
				a -= c * 10
				n += c
			else:
				b = a
				n += 1
	print(n)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	moves = 0
	dif = abs(a - b)
	if dif >= 10:
		moves = moves + dif // 10
	resto = dif % 10
	if resto > 0:
		moves = moves + 1
	print(moves)


loops = int(input())
for i in range(loops):
	times = 0
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	if a > b and abs(a - b) % 2 == 0:
		print(1)
	elif a < b and abs(a - b) % 2 != 0:
		print(1)
	else:
		print(2)


import math
case = int(input())
for numero in range(case):
	nums = input().split()
	a = int(nums[0])
	b = int(nums[1])
	x = (a - b) / 10
	parte_decimal = abs(x) - abs(int(x))
	if round(parte_decimal, 1) != 0.0:
		print(abs(int(x)) + 1)
	else:
		print(abs(round(x)))


n = int(input())
for _ in range(n):
	arr = list(map(int, input().split(' ')))
	if arr[0] == arr[1]:
		print('0')
	elif arr[0] < arr[1]:
		diff = arr[1] - arr[0]
		if diff % 2 == 1:
			print('1')
		else:
			print('2')
	else:
		diff = arr[0] - arr[1]
		if diff % 2 == 0:
			print('1')
		else:
			print('2')


import sys

def solve(a, b):
	diff = abs(a - b)
	cnt = diff // 10
	return cnt + (1 if cnt * 10 < diff else 0)
IN = [x.strip() for x in sys.stdin.readlines()]
T = int(IN[0])
cur = 0
for ti in range(T):
	(a, b) = [int(x) for x in IN[cur + 1].split(' ')]
	res = solve(a, b)
	print(res)
	cur += 1


import math
my_value = []
for i in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	if b > a:
		my_value.append(math.ceil((b - a) / 10))
	else:
		my_value.append(math.ceil((a - b) / 10))
for i in my_value:
	print(i)


import sys
import bisect
import math as mt
input = sys.stdin.readline
t = int(input())
mod = 10 ** 9 + 7
for _ in range(t):
	(a, b) = map(int, input().split())
	maxi = max(a, b)
	mini = min(a, b)
	diff = maxi - mini
	ans = diff // 10
	diff %= 10
	if diff != 0:
		ans += 1
	print(ans)


testcNses = int(input())
for _ in range(testcNses):
	(N, K) = map(int, input().split())
	if (K - N) % 2 != 0 and K > N:
		print(1)
	elif (N - K) % 2 != 0 and N > K:
		print(2)
	elif (K - N) % 2 == 0 and K > N:
		print(2)
	elif (N - K) % 2 == 0 and N > K:
		print(1)
	elif N == K:
		print(0)


t = int(input())
s = ''
for i in range(t):
	c = 0
	(a, b) = map(int, input().split())
	if a < b:
		if (b - a) % 2 == 0:
			c = 2
		else:
			c = 1
	if a > b:
		if (a - b) % 2 != 0:
			c = 2
		else:
			c = 1
	s += str(c) + ' '
print(s.replace(' ', '\n'))


import sys

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math
from collections import defaultdict
for _ in range(ri()):
	(a, b) = ria()
	x = abs(a - b)
	wi(x // 10) if x % 10 == 0 else wi(x // 10 + 1)


test_cases = int(input())
ans = []
for i in range(test_cases):
	moves = 0
	counter = 10
	(a, b) = [int(x) for x in input().split(' ')]
	dif = abs(b - a)
	while counter != 0:
		moves += dif // counter
		dif = dif % counter
		counter -= 1
	ans.append(moves)
for move in ans:
	print(move)


def diff(a, b):
	if a == b:
		return 0
	elif a > b:
		minus = a - b
	else:
		minus = b - a
	ans = 0
	if minus >= 10:
		ans += minus // 10
		minus = minus % 10
	if minus % 10 != 0:
		ans += 1
	return ans
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(diff(a, b))


import sys
t = int(input().strip())
for a0 in range(t):
	l = [int(i) for i in input().split()]
	n = l[0]
	k = l[1]
	if k > n:
		temp = n
		n = k
		k = temp
	c1 = 0
	c2 = 0
	if (n - k) % 10 == 0:
		print((n - k) // 10)
	else:
		print((n - k) // 10 + 1)


import math, sys, itertools

def solve(a, b):
	dif = abs(a - b)
	ans = int(math.ceil(dif / 10))
	return ans
for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	print(solve(a, b))


import sys
from math import sqrt
from collections import defaultdict
inpt = sys.stdin.readline

def inp():
	return int(inpt())

def inlist():
	return list(map(int, inpt().split()))

def instr():
	s = inpt()
	return list(s[:len(s) - 1])

def invr():
	return map(int, inpt().split())

class Graph:

	def __init__(self, n):
		self.n = n
		self.graph = defaultdict(list)
		self.marked = defaultdict(int)

	def addEdge(self, u, v):
		self.graph[u].append(v)
		self.graph[v].append(u)

	def dfs(self, u):
		self.marked[u] = 1
		for i in self.graph[u]:
			if self.marked[i] == 0:
				self.dfs(i)

def main():
	t = inp()
	for l in range(t):
		(a, b) = invr()
		if a == b:
			ans = 0
		else:
			ans = abs(b - a) // 10
			if abs(b - a) % 10 != 0:
				ans += 1
		print(ans)
main()


t = int(input())
output = []
for i in range(t):
	(a, b) = map(int, input().split())
	c = 0
	if abs(b - a) != 0:
		d = abs(b - a)
		q = d // 10
		r = d % 10
		if r == 0:
			c = q
		else:
			c = q + 1
	output.append(c)
for i in output:
	print(i)


n = int(input())
for i in range(0, n):
	(a, b) = map(int, input().split())
	c = a - b
	d = abs(c)
	if d % 10 == 0:
		p = d / 10
		e = int(p)
		print(e)
	else:
		q = d / 10
		n = int(q)
		print(n + 1)


cases = int(input())
for case in range(cases):
	(a, b) = tuple(map(int, input().rstrip().split()))
	if a == b:
		print(0)
	elif a < b:
		if (b - a) % 2 == 0:
			print(2)
		else:
			print(1)
	elif (a - b) % 2 == 0:
		print(1)
	else:
		print(2)


from collections import Counter
import string
import math
import sys
from fractions import Fraction

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))

def printDivisors(n):
	divisors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				divisors.append(i)
			else:
				divisors.extend((i, n // i))
		i = i + 1
	return divisors

def countTotalBits(num):
	binary = bin(num)[2:]
	return len(binary)

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
for _ in range(vary(1)):
	(a, b) = vary(2)
	pt = abs(a - b)
	ans = 0
	for i in range(10, 0, -1):
		ans += pt // i
		pt = pt % i
	print(ans)


from math import ceil
for T in range(int(input())):
	(a, b) = list(map(int, input().split()))
	(b, a) = (max(a, b), min(a, b))
	d = b - a
	print(ceil(d / 10))


from sys import stdin

def iinput():
	return int(stdin.readline())

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
from collections import defaultdict
from math import factorial
t = iinput()
while t:
	t -= 1
	(a, b) = minput()
	dif = abs(a - b)
	rem = 1 if dif % 10 != 0 else 0
	print(dif // 10 + rem)


test_cases = int(input())

def solve():
	data = input().split(' ')
	a = int(data[0])
	b = int(data[1])
	diff = abs(a - b)
	min_moves = diff // 10
	if diff % 10 != 0:
		min_moves += 1
	print(min_moves)
for i in range(test_cases):
	solve()


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	res = math.ceil((b - a) / 10)
	print(res)


t = int(input())
while t > 0:
	t -= 1
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	c = abs(a - b)
	if c % 10 == 0:
		print(c // 10)
	else:
		print(c // 10 + 1)


from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))

def solve():
	(ans, num) = (0, 10)
	(a, b) = get_tuple()
	if a > b:
		(a, b) = (b, a)
	rem = b - a
	while rem > 0:
		(div, rem) = divmod(rem, num)
		num -= 1
		ans += div
	print(ans)

def main():
	solve()
TestCases = True
if TestCases:
	for i in range(get_int()):
		main()
else:
	main()


num_of_test_cases = int(input())
answer = 0
for i in range(num_of_test_cases):
	(a, b) = [int(i) for i in input().split()]
	if abs(a - b) % 10 != 0:
		print(abs(a - b) // 10 + 1)
	else:
		print(abs(a - b) // 10)


import math
t = int(input())
while t > 0:
	t -= 1
	(a, b) = [int(j) for j in input().split()]
	temp = abs(a - b)
	print(math.ceil(temp / 10))


t = int(input())
for j in range(0, t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		ee = abs(b - a)
		if ee % 10 == 0:
			print(ee // 10)
		else:
			print(ee // 10 + 1)


for i in range(int(input())):
	A = list(map(int, input().split()))
	diff = A[1] - A[0]
	if diff == 0:
		print(0)
	elif diff % 2 == 0 and diff > 0:
		print(2)
	elif diff % 2 == 0 and diff > 0:
		print(2)
	elif diff % 2 == 0 and diff < 0:
		print(1)
	elif diff % 2 != 0 and diff > 0:
		print(1)
	elif diff % 2 != 0 and diff < 0:
		print(2)


import sys
import os
from io import IOBase, BytesIO
import math
mod = 10 ** 9 + 7
pie = 3.1415926536

def modinv(n, p):
	return pow(n, p - 2, p)

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def ain():
	return list(map(int, sin().split()))

def sin():
	return input().strip()

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def read2DIntArray(row, col):
	arr = []
	for i in range(0, row):
		temp = list(map(int, sin().split()))
		arr.append(temp)
	return arr

def read2DCharArray(row, col):
	arr = []
	for i in range(0, row):
		temp = str(sin())
		arr.append(temp)
	return arr

def smallestNumber(n):
	lst = list(str(n))
	lst.sort()
	tmp = ''
	for (i, n) in enumerate(lst):
		if n != '0':
			tmp = lst.pop(i)
			break
	return str(tmp) + ''.join(lst)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	lst = []
	for p in range(n + 1):
		if prime[p]:
			lst.append(p)
	return lst

def nCr(n, r):
	a = 1
	b = 1
	c = 1
	for i in range(1, n + 1):
		c *= i
	for i in range(1, r + 1):
		b *= i
	for i in range(1, n - r + 1):
		a *= i
	return c // (a * b)

def sieveOfEratosthenes1(N, s):
	prime = [False] * (N + 1)
	for i in range(2, N + 1, 2):
		s[i] = 2
	for i in range(3, N + 1, 2):
		if prime[i] == False:
			s[i] = i
			for j in range(i, int(N / i) + 1, 2):
				if prime[i * j] == False:
					prime[i * j] = True
					s[i * j] = i

def generatePrimeFactors(N):
	s = [0] * (N + 1)
	sieveOfEratosthenes1(N, s)
	curr = s[N]
	cnt = 1
	factors = []
	power = []
	while N > 1:
		N //= s[N]
		if curr == s[N]:
			cnt += 1
			continue
		factors.append(curr)
		power.append(cnt)
		curr = s[N]
		cnt = 1
	return (factors, power)

def main():
	for _ in range(int(sin())):
		(a, b) = map(int, sin().split())
		if a == b:
			print('0')
		elif a > b:
			diff = a - b
			if diff % 2 == 0:
				print('1')
			else:
				print('2')
		elif a < b:
			diff = b - a
			if diff % 2 != 0:
				print('1')
			else:
				print('2')
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


def f(a, b):
	if a == b:
		return 0
	elif a > b and a % 2 == b % 2:
		return 1
	elif a > b and a % 2 != b % 2:
		return 2
	elif a < b and a % 2 != b % 2:
		return 1
	elif a < b and a % 2 == b % 2:
		return 2
t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	print(f(a, b))
	t -= 1


import math

def solve(a, b):
	if a == b:
		return 0
	diff = abs(a - b)
	return math.ceil(diff / 10)
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(solve(a, b))


t = int(input())
inputs = [''] * t
for i in range(t):
	inputs[i] = input()
for s in inputs:
	(a, b) = map(int, s.split())
	d = b - a
	if d == 0:
		print(0)
	elif d > 0 and d % 2 == 1:
		print(1)
	elif d < 0 and d % 2 == 0:
		print(1)
	else:
		print(2)


casee = int(input())
for cases in range(0, casee, 1):
	s = input()
	(a, b) = s.split()
	a = int(a)
	b = int(b)
	if a == b:
		print(0)
	else:
		c = abs(a - b)
		kk = c / 10
		if kk - int(kk) == 0:
			print(int(kk))
		else:
			k = int(kk) + 1
			print(int(k))


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	dfc = abs(a - b)
	minimo = dfc // 10 + (dfc % 10 != 0)
	print(minimo)
	t -= 1


t = int(input())
import math

def solve(a, b):
	res = math.ceil(abs(b - a) / 10)
	return res
for _ in range(t):
	(n, s) = [int(x) for x in input().split(' ')]
	print(solve(n, s))


t = int(input())
for _ in range(t):
	ab = list(map(int, input().split()))
	a = ab[0]
	b = ab[1]
	r = abs(a - b)
	if r == 0:
		print('0')
	else:
		if r % 10 == 0:
			res = r // 10
		else:
			res = r // 10 + 1
		print(res)


N_SETS = int(input())
for i in range(N_SETS):
	(a, b) = [int(x) for x in input().split()]
	(a, b) = (min(a, b), max(a, b))
	print((b - a) // 10 + int((b - a) % 10 != 0))


try:
	t = int(input())
	for i in range(t):
		(a, b) = list(map(int, input().split()))
		res = abs(a - b)
		if res % 10 == 0:
			print(int(res / 10))
			continue
		res = int(res / 10) + 1
		print(res)
except:
	pass


def main():
	T = int(input())
	for _ in range(T):
		(a, b) = (int(i) for i in input().split())
		if a < b:
			(a, b) = (b, a)
		ans = abs(b - a) // 10
		if abs(b - a) % 10 != 0:
			ans += 1
		print(ans)
main()


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


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	nMoves = 0
	if a != b:
		if a < b:
			if a % 2 == 0 and b % 2 == 0 or (a % 2 == 1 and b % 2 == 1):
				nMoves = 2
			else:
				nMoves = 1
		if a > b:
			if a % 2 == 0 and b % 2 == 0 or (a % 2 == 1 and b % 2 == 1):
				nMoves = 1
			else:
				nMoves = 2
	print(nMoves)
	t -= 1


t = int(input())
while t != 0:
	step = 0
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	ans = abs(a - b)
	if ans != 0:
		step = step + ans // 10
	if ans % 10 != 0:
		step = step + 1
	print(step)
	t = t - 1


def solveTestCase(a, b):
	diff = abs(b - a)
	if diff % 10 == 0:
		return diff // 10
	else:
		return 1 + diff // 10
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(solveTestCase(a, b))


t = int(input())
for i in range(t):
	(n1, n2) = map(int, input().split())
	if n1 >= n2:
		k = n1 - n2
		n = k // 10
		if k % 10 == 0:
			print(n)
		else:
			print(n + 1)
	else:
		k = n2 - n1
		n = k // 10
		if k % 10 == 0:
			print(n)
		else:
			print(n + 1)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	if abs(b - a) == 0:
		print(0)
	elif abs(b - a) <= 10:
		print(1)
	else:
		mini = 10 ** 18
		for i in range(1, 11):
			z = abs(b - a) // i
			k = a
			k += z * i
			if abs(b - k) != 0:
				mini = min(z + 1, mini)
			else:
				mini = min(z, mini)
		print(mini)


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


import math
import collections
import functools
import sys
import os

def solve():
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		return
	if b < a:
		res = 1
		if (b - a) % 2:
			res += 1
		print(res)
		return
	if a < b:
		res = 1
		if (a - b) % 2 == 0:
			res += 1
		print(res)
		return

def main():
	T = 1
	T = int(input())
	while T:
		solve()
		T -= 1
main()


line = input()
while True:
	try:
		step = 0
		line = input().split()
		a = int(line[0])
		b = int(line[1])
		if a == b:
			step = 0
		else:
			dif = abs(a - b)
			i = 10
			while dif > 0:
				step += dif // i
				dif = dif % i
				i -= 1
		print(step)
	except EOFError:
		break


import math
t = int(input())
while t > 0:
	t -= 1
	(x, y) = map(int, input().strip().split(' '))
	diff = abs(x - y)
	ans = math.ceil(diff / 10)
	print(ans)


__version__ = '0.1'
__date__ = '2021-04-01'
import sys

def solve(a, b):
	tens = (abs(b - a) + 9) // 10
	return tens

def main(argv=None):
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		print(solve(a, b))
	return 0
STATUS = main()
sys.exit(STATUS)


t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a < b:
		if a % 2 != 0 and b % 2 == 0:
			print(1)
		elif a % 2 == 0 and b % 2 != 0:
			print(1)
		else:
			print(min(b - a, 2))
	elif a % 2 != 0 and b % 2 == 0:
		print(2)
	elif a % 2 == 0 and b % 2 != 0:
		print(2)
	else:
		print(1)


import math
t = int(input())
for i in range(t):
	(a, b) = map(int, input().strip().split(' '))
	c = abs(a - b)
	c = math.ceil(c / 10)
	print(c)


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = 0
	y = 0
	if a == b:
		print('0')
	elif a < b:
		x = b - a
		print(math.ceil(x / 10))
	else:
		y = a - b
		print(math.ceil(y / 10))


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))

def removeall_replace(element, lst):
	t = [y for y in lst if y != element]
	del lst[:]
	lst.extend(t)
for _ in range(get_int()):
	(a, b) = get_int_list()
	if a == b:
		print(0)
	elif a < b:
		diff = abs(a - b)
		if diff % 2 != 0:
			print(1)
		else:
			print(2)
	else:
		diff = abs(a - b)
		if diff % 2 == 0:
			print(1)
		else:
			print(2)


import math
t = int(input())
for i in range(t):
	(p, a) = [int(i) for i in input().split()]
	sum = abs(p - a) // 10
	if abs(p - a) % 10 != 0:
		sum += 1
	print(sum)


import sys
import time as mt, bisect, sys
import math
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict

def si():
	return int(sys.stdin.readline())

def st():
	return stdin.readline()

def mi():
	return map(int, sys.stdin.readline().split())

def lis():
	return list(map(int, sys.stdin.readline().split()))

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)
test = si()
for _ in range(test):
	(a, b) = mi()
	result = abs(a - b)
	result = result / 10
	print(math.ceil(result))


from sys import stdin, stdout
import math
try:
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		ans = 0
		d = abs(a - b)
		ans = math.ceil(d / 10)
		print(ans)
except:
	pass


def solve(n, k):
	ans = 0
	a = min(n, k)
	b = max(n, k)
	if abs(b - a) % 10 == 0:
		ans = abs(b - a) // 10
	else:
		temp = (b - a) // 10
		ans = temp + 1
	print(ans)
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	solve(n, k)


def check(n, m):
	if n == m:
		return 0
	elif n < m:
		if n % 2 != 0 and m % 2 == 0:
			return 1
		elif n % 2 != 0 and m % 2 != 0:
			return 2
		elif n % 2 == 0 and m % 2 == 0:
			return 2
		else:
			return 1
	elif n % 2 != 0 and m % 2 == 0:
		return 2
	elif n % 2 != 0 and m % 2 != 0:
		return 1
	elif n % 2 == 0 and m % 2 == 0:
		return 1
	else:
		return 2
for i in range(int(input())):
	(n, m) = map(int, input().split())
	print(check(n, m))


import bisect
import copy
import fractions
import functools
import heapq
import math
import random
import sys
T = int(input())
for t in range(T):
	(A, B) = tuple(map(int, input().split()))
	print(str(math.ceil(abs(A - B) / 10)))


from sys import stdin
t = int(stdin.readline())
while t:
	t -= 1
	(a, b) = map(int, stdin.readline().split())
	if a == b:
		moves = 0
	if a > b:
		moves = 1 if a - b & 1 == 0 else 2
	if a < b:
		moves = 1 if a - b & 1 else 2
	print(moves)


def d(a, b):
	if a == b:
		return 0
	else:
		d = abs(a - b)
		if d % 10 == 0:
			return d // 10
		return d // 10 + 1
for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	print(d(a, b))


from sys import stdin, gettrace
if gettrace():
	inputi = input
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def solve():
	(a, b) = map(int, inputi().split())
	d = abs(a - b) // 10
	r = abs(a - b) % 10
	if r == 0:
		print(d)
	else:
		print(d + 1)

def main():
	t = int(inputi())
	for _ in range(t):
		solve()
main()


from math import ceil
for i in range(int(input())):
	(x, y) = map(int, input().split())
	(a, b) = (min(x, y), max(x, y))
	count = ceil((b - a) / 10)
	print(count)


t = input()
t = int(t)
while t > 0:
	s = input()
	(a, b) = [int(x) for x in s.split()]
	if a == b:
		print(0)
	elif abs(a - b) < 11:
		print(1)
	else:
		if a < b:
			ans = int((b - a) / 10)
		else:
			ans = int((a - b) / 10)
		if b % 10 == a % 10:
			print(ans)
		else:
			print(ans + 1)
	t -= 1


from math import ceil
n = int(input())
s = ''
for i in range(n):
	(a, b) = map(int, input().split())
	if a > b:
		s += str(ceil((a - b) / 10)) + '\n'
	if a < b:
		s += str(ceil((b - a) / 10)) + '\n'
	if a == b:
		s += '0\n'
print(s)


n = int(input())
x = []
entry = []
for i in range(n):
	a = list(map(int, input().split()))
	x.append(a)
for i in range(n):
	count = 0
	if x[i][0] < x[i][1]:
		if (x[i][1] - x[i][0]) % 2 == 0:
			count += 2
			entry.append(count)
			continue
		if (x[i][1] - x[i][0]) % 2 != 0:
			count += 1
			entry.append(count)
			continue
	if x[i][0] > x[i][1]:
		if (x[i][0] - x[i][1]) % 2 != 0:
			count += 2
			entry.append(count)
			continue
		if (x[i][0] - x[i][1]) % 2 == 0:
			count += 1
			entry.append(count)
			continue
	if x[i][0] == x[i][1]:
		entry.append(count)
for i in range(n):
	print(entry[i])


tot = int(input())
steps = 0
lst = list()
for i in range(tot):
	(a, b) = map(int, input().split())
	lst.append(a)
	lst.append(b)
for i in range(len(lst)):
	if i % 2 == 0:
		continue
	elif i % 2 != 0:
		a = lst[i - 1]
		b = lst[i]
		diff = a - b
		print((abs(diff) + 9) // 10)


testcases = int(input())
for x in range(testcases):
	(a, b) = map(int, input().split())
	moves = 0
	x = b - a
	if x == 0:
		print(0)
	elif x > 0:
		z = b - a
		if z % 10 == 0:
			moves += z // 10
		else:
			moves += z // 10 + 1
		print(moves)
	else:
		z = a - b
		if z % 10 == 0:
			moves += z // 10
		else:
			moves += z // 10 + 1
		print(moves)


import array
arr = array.array('i', [])
n = int(input())
ans = 0
for i in range(0, n):
	(a, b) = map(int, input().split())
	if a == b:
		ans = 0
	else:
		d = abs(a - b)
		ans = (d + 9) // 10
	arr.append(ans)
for e in arr:
	print(e)


for _ in range(int(input())):
	(x, z) = map(int, input().split())
	print((abs(x - z) + 9) // 10)


import math
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	distancia = abs(a - b)
	pasos = distancia / 10
	total = math.ceil(pasos)
	print(total)


T = int(input())
for _ in range(T):
	(a, b) = list(map(int, input().split()))
	d = abs(a - b)
	ans = d // 10 + int(d % 10 > 0)
	print(ans)


t = int(input())
while t:
	(x, y) = map(int, input().split())
	i = 0
	if x < y:
		a = y - x
		if a % 2 != 0:
			x += a
			i += 1
		else:
			x += a - 1
			x += 1
			i += 2
	elif x > y:
		a = x - y
		if a % 2 == 0:
			x -= a
			i += 1
		else:
			x -= a + 1
			x += 1
			i += 2
	print(f'{i}')
	t -= 1


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi
from collections import deque, defaultdict
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
for _ in range(I()):
	(a, b) = R()
	print((abs(a - b) + 9) // 10)


x = int(input())
k = list()
for i in range(x):
	a = list(map(int, input().split()))
	x = abs(a[0] - a[1])
	if x % 10 == 0:
		k.append(x // 10)
	else:
		k.append(x // 10 + 1)
for i in k:
	print(i)


import math
for i in range(int(input())):
	a = list(map(int, input().strip().split()))[:2]
	b = abs(a[0] - a[1])
	d = math.ceil(b / 10)
	print(d)


n = int(input())
aps = 0
aman = 0
for i in range(0, n):
	(a, b) = map(int, input().split())
	if a == b:
		print('0')
		continue
	if b > a:
		aman = b - a
		if aman % 2 == 1:
			print('1')
			continue
	if b < a:
		aman = a - b
		if aman % 2 == 0:
			print('1')
			continue
	print('2')


for _ in range(int(input())):
	(a, b) = map(int, input().strip().split())
	d = abs(a - b)
	l = [i for i in range(10, 0, -1)]
	s = 0
	for i in l:
		if d >= i:
			s += d // i
			d = d % i
	print(s)


a = int(input())
for i in range(a):
	(a, b) = map(int, input().split())
	c = max(a, b) - min(a, b)
	d = c / 10
	e = c % 10
	if e == 0:
		print(int(d))
	else:
		d = d + 1
		print(int(d))


def moves(a, b):
	if b != a:
		if b > a:
			if (b - a) % 10 != 0:
				return (b - a) // 10 + 1
			return (b - a) // 10
		else:
			if (a - b) % 10 != 0:
				return (a - b) // 10 + 1
			return (a - b) // 10
	else:
		return 0
test_cases = int(input())
for i in range(0, test_cases):
	info = list(map(int, input().split()))
	a = info[0]
	b = info[1]
	print(moves(a, b))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = a - b
	if x < 0:
		x = -1 * x
	y = x // 10
	if x % 10 > 0:
		y += 1
	print(y)


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


def function(a, b):
	if a == b:
		return 0
	elif a < b:
		if (b - a) % 2 == 0:
			return 2
		else:
			return 1
	elif (a - b) % 2 == 0:
		return 1
	else:
		return 2
testcases = int(input())
for i in range(testcases):
	a = list(map(int, input().split()))
	print(function(a[0], a[1]))


def solve():
	(a, b) = [int(x) for x in input().split(' ')]
	if a % 2 == 0:
		a_even = True
	else:
		a_even = False
	if b % 2 == 0:
		b_even = True
	else:
		b_even = False
	if a == b:
		return 0
	elif a > b:
		if a_even and b_even:
			return 1
		elif a_even and (not b_even):
			return 2
		elif not a_even and b_even:
			return 2
		else:
			return 1
	elif a_even and b_even:
		return 2
	elif a_even and (not b_even):
		return 1
	elif not a_even and b_even:
		return 1
	else:
		return 2
t = int(input())
for i in range(1, t + 1):
	ans = solve()
	print(ans)


import sys
input = sys.stdin.readline
output = sys.stdout.write

def main():
	test_cases = int(input().rstrip())
	for i in range(test_cases):
		(a, b) = map(int, input().rstrip().split())
		dif = abs(a - b)
		multiplier = dif // 10
		ans = multiplier
		if dif - 10 * ans > 0:
			ans += 1
		output(str(ans))
		output('\n')
main()


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil, pi, sin, cos, acos, atan
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	(a, b) = inp()
	diff = abs(a - b)
	ans = diff // 10
	diff %= 10
	if diff != 0:
		ans += 1
	out(ans)


import math
for t in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		p = a - b
		c = math.ceil(p / 10)
	else:
		p = b - a
		c = math.ceil(p / 10)
	print(c)


t = int(input())
while t:
	(a, b) = input().rstrip().split(' ')
	a = int(a)
	b = int(b)
	if a - b < 0:
		if abs(a - b) % 2 == 0 and abs(a - b) > 0:
			print(2)
		else:
			print(1)
	elif a - b > 0:
		if (a - b) % 2 == 0:
			print(1)
		else:
			print(2)
	else:
		print(0)
	t = t - 1


from fractions import gcd
from itertools import combinations, permutations, accumulate, product
from collections import deque, defaultdict, Counter
import decimal
import re
import sys
sys.setrecursionlimit(10000000)
mod = 10 ** 9 + 7

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

def I():
	return int(input())
for i in range(I()):
	(a, b) = readInts()
	ab = abs(b - a)
	if ab == 0:
		print(0)
	elif a < b:
		if ab % 2:
			print(1)
		else:
			print(2)
	elif ab % 2:
		print(2)
	else:
		print(1)


n = int(input())
(x, y, A) = ([], [], [])
s = 0
r = 0
for i in range(n):
	A.append([int(j) for j in input().split()])
for i in range(len(A)):
	x.append(A[i][0])
	y.append(A[i][1])
for i in range(len(x)):
	if x[i] == y[i]:
		r = 0
		s = 0
	else:
		s = y[i] - x[i]
	if s != 0 and s % 2 != 0:
		if s > 0:
			r = 1
		elif s < 0:
			r = 2
	elif s != 0 and s % 2 == 0:
		if s > 0:
			r = 2
		elif s < 0:
			r = 1
	print(r)


n = int(input())
games = []
for i in range(n):
	games.append(input().split())
for i in range(n):
	temp = games[i]
	temp0 = int(temp[0])
	temp1 = int(temp[1])
	if temp0 == temp1:
		print(0)
		continue
	if temp0 < temp1:
		if (temp1 - temp0) % 2 == 0:
			print(2)
		else:
			print(1)
	elif (temp0 - temp1) % 2 == 0:
		print(1)
	else:
		print(2)


def solve3(gap):
	ans = 0
	for divider in range(10, 0, -1):
		ans += gap // divider
		gap %= divider
	return ans
for testcases in range(int(input())):
	(a, b) = map(int, input().split())
	print(solve3(abs(a - b)))


for case in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	if a > b:
		(a, b) = (b, a)
	c = b - a
	res = 0
	for k in range(10, 0, -1):
		res += c // k
		c = c % k
	print(res)


def i():
	return input()

def ii():
	return int(input())

def iis():
	return map(int, input().split())

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


for test in range(int(input())):
	(a, b) = map(int, input().split())
	temp = a - b
	if temp == 0:
		print(0)
		continue
	if a < b:
		temp = -temp
	if temp <= 10:
		print(1)
		continue
	x = temp // 10
	if temp % 10 != 0:
		print(x + 1)
	else:
		print(x)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	answer = 0
	if a > b:
		difference = a - b
	else:
		difference = b - a
	arr = [int(i) for i in str(difference)]
	for i in range(len(arr)):
		if len(arr[i:]) - 1 == 0 and arr[i] != 0:
			answer += 1
		else:
			answer += arr[i] * 10 ** (len(arr[i:]) - 1) / 10
	print(int(answer))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a < b:
		x = b - a
		if x % 10 == 0:
			y1 = x / 10
			print(int(y1))
		else:
			y1 = x // 10
			print(int(y1 + 1))
	elif a > b:
		x2 = a - b
		if x2 % 10 == 0:
			y3 = x2 // 10
			print(int(y3))
		else:
			y3 = x2 // 10
			print(int(y3 + 1))


import math

def getMinMoves(a, b):
	if a == b:
		return 0
	return math.ceil(abs(a - b) / 10)
testCases = input()
for i in range(int(testCases)):
	(a, b) = map(int, input().split())
	ans = getMinMoves(a, b)
	print(ans)


NumOfTests = int(input())
for counter in range(NumOfTests):
	inputs = list(map(int, input().split()))
	a = int(inputs[0])
	b = int(inputs[1])
	temp = abs(b - a)
	moves = temp // 10
	temp -= moves * 10
	while temp != 0:
		temp = 0 if temp <= 10 else temp - 10
		moves += 1
	print(moves)


import sys
read = sys.stdin.buffer.readline
for _ in range(int(read())):
	(a, b) = map(int, read().split())
	print([0, [2, 1][b > a and (b - a) % 2 != 0 or (a > b and (a - b) % 2 == 0)]][a != b])


t = int(input())
count = 0
ls = list()
for i in range(t):
	c = input()
	d = c.split()
	a = int(d[0])
	b = int(d[1])
	if a == b:
		ls.append('0')
	elif a > b and (a - b) % 2 == 0:
		ls.append('1')
	elif b > a and (b - a) % 2 != 0:
		ls.append('1')
	else:
		ls.append('2')
for i in ls:
	print(i)


import os
import sys
import math
import collections

def get_int():
	return int(input())

def get_ints():
	return map(int, input().split())

def get_strs():
	return input().split()

def get_float():
	return float(input())

def get_floats():
	return map(float, input().split())

def list_strs():
	return list(input().split())

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

def list_floats():
	return list(map(float, input.split()))

def post(x):
	print(x, end=' ')
T = int(input())
for t in range(1, T + 1):
	(a, b) = get_ints()
	d = abs(a - b)
	d = (d + 9) // 10
	print(d)


t = int(input())
for i in range(t):
	(a, b) = [int(x) for x in input().split()]
	move = 0
	while a != b:
		if a < b:
			sub = b - a
			if sub % 2 != 0:
				x = sub
				a = a + x
				move += 1
			else:
				x = sub - 1
				a = a + x
				move += 1
		else:
			sub = a - b
			if sub % 2 == 0:
				y = sub
				a = a - y
				move += 1
			else:
				y = sub + 1
				a = a - y
				move += 1
	print(move)


x = int(input())
test_cases = []
for i in range(x):
	a = [int(x) for x in input().split()]
	test_cases.append(a)
for t in test_cases:
	if t[0] == t[1]:
		print(0)
	else:
		a = t[0]
		b = t[1]
		counter = 0
		if b > a:
			diff = b - a
			while diff != 0:
				if diff >= 10:
					a = a + int(diff / 10) * 10
					counter = counter + int(diff / 10)
					diff = b - a
				else:
					a = a + diff
					diff = b - a
					counter = counter + 1
		else:
			diff = a - b
			while diff != 0:
				if diff >= 10:
					a = a - int(diff / 10) * 10
					counter = counter + int(diff / 10)
					diff = a - b
				else:
					a = a - diff
					diff = a - b
					counter = counter + 1
		print(counter)


from math import ceil
x = int(input())
lst = []
for a in range(x):
	inp = input()
	space_inp = [int(q) for q in inp.split(' ')[:2]]
	lst.append(space_inp)
ans = []
for (a, b) in lst:
	if a >= b:
		c = a - b
		c = int(ceil(c / 10))
		ans.append(c)
	if a < b:
		c = b - a
		c = int(ceil(c / 10))
		ans.append(c)
for a in ans:
	print(a)


for s in [*open(0)][1:]:
	print(0 - abs(eval(s.replace(' ', '-'))) // -10)


from math import *
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	k = abs(n - m)
	p = ceil(k / 10)
	print(p)


def main():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		if a == b:
			print(0)
			continue
		res = a & 1 ^ b & 1
		if res == 0 and b > a or (res == 1 and b < a):
			print(2)
		else:
			print(1)
main()


t = int(input())
out = []
for i in range(t):
	(a, b) = list(map(int, input().split(' ')))
	if a > b:
		if (a - b) % 2 == 0:
			out.append(1)
		else:
			out.append(2)
	elif a == b:
		out.append(0)
	elif (b - a) % 2 == 1:
		out.append(1)
	else:
		out.append(2)
for o in out:
	print(o)


for i in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	if n - k == 0:
		print('0')
	elif n - k > 0 and abs(n - k) % 2 == 0 or (n - k < 0 and abs(n - k) % 2 == 1):
		print('1')
	else:
		print('2')


inp = int(input())
for i in range(inp):
	s = 0
	(a, b) = input().split()
	div = abs(int(a) - int(b))
	n = 10
	while div != 0:
		s += div // n
		div -= div // n * n
		n -= 1
	print(s)


def solve(a, b):
	tmp = abs(b - a)
	moves = 0
	for i in range(10, 0, -1):
		if tmp % i >= 0:
			moves = moves + tmp // i
			tmp = tmp % i
	return moves
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(solve(a, b))


t = int(input())
for i in range(t):
	ab = list(map(int, input().split()))
	if ab[0] == ab[1]:
		print(0)
	elif ab[0] % 2 == 0:
		if ab[1] % 2 == 0:
			if ab[0] > ab[1]:
				print(1)
			else:
				print(2)
		elif ab[0] > ab[1]:
			print(2)
		else:
			print(1)
	elif ab[1] % 2 == 0:
		if ab[0] > ab[1]:
			print(2)
		else:
			print(1)
	elif ab[0] > ab[1]:
		print(1)
	else:
		print(2)


t = int(input())
n = 0
for i in range(t):
	a = list(map(int, input().split()))
	if a[1] != a[0] and a[1] > a[0] and ((a[1] - a[0]) % 10 != 0):
		raznica = a[1] - a[0]
		raznica1 = raznica // 10
		print(raznica1 + 1)
	if a[1] != a[0] and a[0] > a[1] and ((a[0] - a[1]) % 10 != 0):
		raznica = a[0] - a[1]
		raznica1 = raznica // 10
		print(raznica1 + 1)
	if a[1] == a[0]:
		print(0)
	if a[1] != a[0] and a[1] > a[0] and ((a[1] - a[0]) % 10 == 0):
		raznica = a[1] - a[0]
		raznica1 = raznica // 10
		print(raznica1)
	if a[1] != a[0] and a[0] > a[1] and ((a[0] - a[1]) % 10 == 0):
		raznica = a[0] - a[1]
		raznica1 = raznica // 10
		print(raznica1)


import math
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(int((max(a, b) - min(a, b)) // 10) + int((max(a, b) - min(a, b)) % 10 != 0))


def main():
	t = int(input())
	for _ in range(t):
		(n, m) = map(int, input().split())
		if n == m:
			ans = 0
		else:
			k = max(n, m) - min(m, n)
			ans = k // 10
			if k % 10 != 0:
				ans += 1
		print(ans)
main()


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	moves = 0
	difference = abs(a - b)
	moves = difference // 10
	difference = difference - moves * 10
	if difference != 0:
		moves += 1
	print(moves)


t = int(input())
for i in range(t):
	s = input().split()
	(a, b) = (int(s[0]), int(s[1]))
	q = abs(a - b)
	p = q // 10
	p += 1 if q % 10 > 0 else 0
	print(p)


import sys
input = sys.stdin.readline

def main():
	t = inp()
	for testcase in range(0, t):
		input = inlt()
		a = input[0]
		b = input[1]
		dif = b - a
		min_moves = abs(b - a) // 10
		if abs(b - a) % 10 > 0:
			min_moves += 1
		print(min_moves)

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
main()


from sys import stdin
tt = int(stdin.readline())
for loop in range(tt):
	(a, b) = map(int, stdin.readline().split())
	s = abs(a - b)
	print((s + 9) // 10)


t = int(input())
res = []
for i in range(t):
	(a, b) = [int(x) for x in input().split()]
	count = 0
	if a == b:
		res.append(0)
	if a < b:
		temp = b - a
		if temp % 10 == 0:
			count = temp // 10
		else:
			count = temp // 10
			count += 1
		res.append(count)
	elif a > b:
		temp = a - b
		if temp % 10 == 0:
			count = temp // 10
		else:
			count = temp // 10
			count += 1
		res.append(count)
print(*res)


import math
from decimal import Decimal
import heapq
import copy
import heapq
from collections import deque

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def da():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	return (n, m, a)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def prost(x):
	d = math.sqrt(x)
	d = int(d) + 1
	for i in range(2, d):
		if x % i == 0:
			return False
	return True

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def fact(n):
	tc = []
	ans = {}
	d = 2
	while d * d <= n:
		if n % d == 0:
			tc.append(d)
			n //= d
		else:
			d += 1
	if n > 1:
		tc.append(n)
	for i in tc:
		ans[i] = ans.get(i, 0) + 1
	return ans
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	if a > b:
		d = a - b
		if d % 2 == 0:
			print(1)
		else:
			print(2)
	else:
		d = b - a
		if d % 2 == 1:
			print(1)
		else:
			print(2)


for t in range(int(input())):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	ans = 0
	for v in range(10, 0, -1):
		ans += diff // v
		diff -= diff // v * v
	print(ans)


for t in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	if a == b:
		print(0)
	else:
		diff = abs(a - b)
		count = 0
		if diff <= 10 and diff > 0:
			print(1)
		else:
			l = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
			i = 0
			while diff > 0:
				if 1 <= diff <= 10:
					count += 1
					diff = 0
				else:
					count += (diff - diff % l[i]) // l[i]
					diff = diff % l[i]
					i += 1
			print(count)


t = int(input())
s = []
for i in range(t):
	(a, b) = map(int, input().split())
	s.append(a)
	s.append(b)
t = t * 2
for p in range(0, t, 2):
	if s[p] == s[p + 1]:
		print(0)
	elif s[p] > s[p + 1]:
		r = (s[p] - s[p + 1]) // 10
		if (s[p] - s[p + 1]) % 10 == 0:
			print(r)
		else:
			r += 1
			print(r)
	else:
		r = (s[p + 1] - s[p]) // 10
		if (s[p + 1] - s[p]) % 10 == 0:
			print(r)
		else:
			r += 1
			print(r)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b) = sorted([int(i) for i in input().split()])
	c = b - a + 9
	print(c // 10)


t = int(input())
for i in range(t):
	l = list(map(int, input().strip().split()))[:2]
	a = l[0]
	b = l[1]
	if a < b:
		d = b - a
		if d == 1:
			print('1')
		elif d % 2 == 0 and d > 1:
			print('2')
		else:
			print('1')
	elif a > b:
		d = a - b
		if d == 1:
			print('2')
		elif d % 2 == 0 and d > 1:
			print('1')
		else:
			print('2')
	else:
		print('0')


import math
t = int(input())
for _ in [0] * t:
	(a, b) = map(int, input().split())
	print(1 + math.floor(abs(a - b) / 10)) if abs(a - b) % 10 != 0 else print(math.floor(abs(a - b) / 10))


import math
a = int(input())

def f(L):
	x = int(L[0])
	y = int(L[1])
	z = abs(math.ceil(abs(y - x) / 10))
	print(z)
for i in range(a):
	e = input().split()
	f(e)


n = int(input())
for _ in range(n):
	(a, b) = [int(i) for i in input().split()]
	if a > b:
		dif = a - b
		if dif % 2 == 0:
			print(1)
		if dif % 2 != 0:
			print(2)
	if a < b:
		dif = b - a
		if dif % 2 == 0:
			print(2)
		else:
			print(1)
	if a == b:
		print(0)


from sys import stdin
A = int(stdin.readline())
for i in range(A):
	(a, b) = list(map(int, stdin.readline().split(' ')))
	if a == b:
		print('0')
	elif a < b:
		if (b - a) % 2 == 1:
			print('1')
		else:
			print('2')
	elif (a - b) % 2 == 1:
		print('2')
	else:
		print('1')


q = int(input())
sol = 0
while q > 0:
	q -= 1
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	x = b - a
	if x == 0:
		sol = 0
	elif x > 0 and x % 2 == 1 or (x < 0 and -x % 2 == 0):
		sol = 1
	else:
		sol = 2
	print(sol)


x = int(input(''))
z = []
for i in range(0, x):
	z.append(tuple(input('').split(' ')))
for x in range(len(z)):
	z[x] = (int(z[x][0]), int(z[x][1]))
for x in z:
	a = x[0]
	b = x[1]
	diff = b - a
	steps = 0
	if diff < 0:
		diff *= -1
	for n in range(10, 0, -1):
		m = diff // n
		steps += m
		diff -= n * m
	print(steps)


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


def solution(n, m):
	z = n - m
	c = 0
	while z > 0:
		for i in range(10, 0, -1):
			if z // i > 0:
				c += z // i
				k = z % i
				break
		z = k
	print(c)
for i in range(int(input())):
	(n, m) = map(int, input().split())
	solution(max(n, m), min(n, m))


import math
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	print((abs(a - b) + 9) // 10)


T = int(input())
for cs in range(T):
	(a, b) = map(int, input().split())
	print((abs(a - b) - 1) // 10 + 1 if a != b else 0)


def diff(a, b):
	if a > b:
		return a - b
	else:
		return b - a
n = int(input())
for i in range(0, n):
	string = input()
	a = int(string.split(' ')[0])
	b = int(string.split(' ')[1])
	if a == b:
		print(0)
	elif diff(a, b) % 10 == 0:
		print(int(diff(a, b) / 10))
	else:
		print(int(diff(a, b) // 10 + 1))


import math
t = int(input())
for _ in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	c = abs(a - b)
	print(math.ceil(c / 10))


(T, *AB) = map(int, open(0).read().split())
for (a, b) in zip(*[iter(AB)] * 2):
	d = b - a
	if d == 0:
		print(0)
	elif d < 0:
		if d % 2 == 0:
			print(1)
		else:
			print(2)
	elif d % 2 == 0:
		print(2)
	else:
		print(1)


def main():
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		minimumMoves = 0
		difference = 0
		if a == b:
			minimumMoves = 0
		else:
			difference = abs(a - b)
			minimumMoves = difference // 10
			if difference % 10 != 0:
				minimumMoves += 1
		print(minimumMoves)
main()


case = int(input())
for i in range(0, case):
	(x, y) = [int(x) for x in input().split()]
	if x % 2 == y % 2:
		if x == y:
			answer = 0
		elif x > y:
			answer = 1
		else:
			answer = 2
	elif x > y:
		answer = 2
	else:
		answer = 1
	print(answer)


from sys import stdin
input = stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		if a == b:
			print(0)
		else:
			if a > b:
				(a, b) = (b, a)
			print((b - a + 9) // 10)
main()


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	v = abs(a - b)
	print((v + 10 - 1) // 10)


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	if a == b:
		print(0)
		continue
	if b - a <= 10:
		print(1)
	else:
		ans = (b - a) // 10
		if (b - a) % 10 != 0:
			ans += 1
		print(ans)


for t in range(int(input())):
	(a, b) = map(int, input().split())
	diff = abs(b - a)
	if diff == 0:
		print(0)
	elif 0 < diff <= 10:
		print(1)
	else:
		q = int(diff / 10)
		r = int(diff % 10)
		if r != 0:
			q += 1
		print(q)


def main():
	tc = int(input().strip())
	for c in range(tc):
		(a, b) = [int(i) for i in input().split(' ')]
		diff = abs(a - b)
		tmp = diff // 10
		if diff % 10 != 0:
			tmp += 1
		print(tmp)
main()


test = int(input())
while test:
	test -= 1
	main_input = input()
	(first, last) = [int(x) for x in main_input.split(' ')]
	if first == last:
		print(0)
	elif first < last:
		print(2 if (last - first) % 2 == 0 else 1)
	else:
		rem = first - last
		print(1 if rem % 2 == 0 else 2)


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(t,) = I()
for _ in range(t):
	(a, b) = I()
	tt = abs(b - a)
	print(tt // 10 + bool(tt % 10))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	k = b - a
	k = abs(k)
	count1 = 0
	while k > 0:
		if k >= 10:
			count1 += k // 10
			k = k % 10
		else:
			count1 += 1
			break
	print(count1, end='\n')


import math
t = int(input())
for i in range(t):
	l = list(map(int, input().split(' ')))
	a = l[0]
	b = l[1]
	moves = 0
	res = abs(a - b) / 10
	moves += math.floor(res)
	if abs(a - b) % 10 != 0:
		moves += 1
	print(moves)


n = int(input())
m = []
for i in range(n):
	(a, b) = map(int, input().split())
	if a == b:
		m.append(0)
	elif a > b and (a + b) % 2 == 1:
		m.append(2)
	elif a > b and (a + b) % 2 == 0:
		m.append(1)
	elif a < b and (a + b) % 2 == 1:
		m.append(1)
	elif a < b and (a + b) % 2 == 0:
		m.append(2)
for i in m:
	print(i)


for _ in range(int(input())):
	a = list(map(int, input().split(' ')))
	n = a[0]
	m = a[1]
	sum = abs(n - m) // 10
	if abs(n - m) % 10 != 0:
		sum += 1
	print(sum)


from sys import *
input = stdin.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	cn = (b - a) // 10
	r = (b - a) % 10
	if r > 0:
		cn += 1
	stdout.write(str(cn) + '\n')


from bisect import bisect_left
import os
import sys
from io import BytesIO, IOBase
from collections import Counter, defaultdict
from collections import deque
from functools import cmp_to_key
import math
import heapq

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	s = set()
	for p in range(2, n + 1):
		if prime[p]:
			s.add(p)
	return s

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	for _ in range(iin()):
		(a, b) = ain()
		x = abs(a - b)
		ans = 0
		i = 10
		while i > 0:
			ans += x // i
			x = x % i
			i -= 1
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if os.getcwd() == 'D:\\code':
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = input()
t = int(t)
for tt in range(0, t):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	move = 0
	while a != b:
		if a < b:
			if (b - a) % 2 == 1:
				move = 1
				break
			else:
				move = 2
				break
		elif (a - b) % 2 == 0:
			move = 1
			break
		else:
			move = 2
			break
	print(move)


t = int(input())
while t != 0:
	t = t - 1
	number = input()
	numbers = number.split(' ')
	a = int(numbers[0])
	b = int(numbers[1])
	subtract = abs(b - a)
	if subtract == 0:
		print(subtract)
	elif subtract <= 10:
		print(1)
	elif subtract > 10:
		answer = divmod(subtract, 10)
		if answer[1] == 0:
			print(answer[0])
		else:
			print(answer[0] + 1)


import math
n = int(input())
t = []
for i in range(n):
	k = input()
	k = k.split(' ')
	g = math.ceil(abs(int(k[0]) - int(k[1])) / 10)
	t.append(g)
for i in t:
	print(i)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if x > y:
		r = x - y
		r = r // 10
		if x - r * 10 != y:
			r += 1
		print(r)
	else:
		r = y - x
		r = r // 10
		if x + r * 10 != y:
			r += 1
		print(r)


N = int(input())
p = []
for i in range(N):
	(a, b) = map(int, input().split())
	if a == b:
		p.append(0)
	elif b - a > 0 and (b - a) % 2 != 0:
		p.append(1)
	elif b - a > 0 and (b - a) % 2 == 0:
		p.append(2)
	elif b - a < 0 and (b - a) % 2 == 0:
		p.append(1)
	elif b - a < 0 and (b - a) % 2 != 0:
		p.append(2)
for j in p:
	print(j)


import math
t = int(input())
while t > 0:
	t -= 1
	(a, b) = map(int, input().split())
	cnt = 0
	if a == b:
		cnt = 0
	elif a < b:
		c = b - a
		if c % 2 != 0:
			cnt = 1
		else:
			cnt = 2
	else:
		c = a - b
		if c % 2 == 0:
			cnt = 1
		else:
			cnt = 2
	print(cnt)


def reach(a, b):
	changes = 0
	if a == b:
		changes = 0
	if a > b:
		if a % 2 == b % 2:
			changes = 1
		else:
			changes = 2
	if a < b:
		if a % 2 == b % 2:
			changes = 2
		else:
			changes = 1
	return changes
testCase = int(input())
CHANGES = []
for i in range(testCase):
	(a, b) = input().split()
	CHANGES.append(reach(int(a), int(b)))
for i in CHANGES:
	print(i)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	ans = 0
	if a == b:
		print(ans)
	else:
		k = 10
		for i in range(k):
			if a == b:
				break
			if a > b:
				a = a - b
				while k != 0:
					ans = a // k
					a -= a // k
					k -= 1
			else:
				a = b - a
				while k != 0:
					ans = a // k
					a -= a // k
					k -= 1
		print(ans)


import sys
from math import ceil
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(ceil(abs(a - b) / 10))


def read(datatype=int):
	return datatype(input())

def readl(datatype=int):
	return list(map(datatype, input().split()))

def printl(data):
	string = ''
	for d in data:
		string += str(d) + ' '
	print(string)

def testcase():
	(a, b) = readl()
	from math import ceil
	ans = ceil(abs(a - b) / 10)
	print(ans)
	return
t = read()
for _ in range(t):
	testcase()


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


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	d = abs(a - b)
	ans = d // 10 + bool(d % 10)
	print(ans)


def ceil(a, b):
	if a % b == 0:
		return a // b
	return a // b + 1
t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().strip().split()))
	print(ceil(abs(a - b), 10))


from math import *
for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	print(ceil(abs(a - b) / 10))


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase

def main():

	def solve():
		(a, b) = [int(x) for x in input().split()]
		if a > b:
			(a, b) = (b, a)
		movesWith10 = (b - a) // 10
		a += 10 * movesWith10
		lastMove = 1 if b - a > 0 else 0
		print(movesWith10 + lastMove)
	t = int(input())
	for i in range(t):
		solve()
BUFFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
input = lambda : sys.stdin.readline().rstrip('\r\n')

def print(*args, **kwargs):
	sep = kwargs.pop('sep', ' ')
	file = kwargs.pop('file', sys.stdout)
	atStart = True
	for x in args:
		if not atStart:
			file.write(sep)
		file.write(str(x))
		atStart = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
main()


from sys import *
t = int(stdin.readline())
for _ in range(t):
	(n, m) = map(int, stdin.readline().split())
	x = abs(n - m)
	if x % 10 != 0:
		print(x // 10 + 1)
	else:
		print(x // 10)


from __future__ import division, print_function
import os, sys
import math
import collections
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

class my_dictionary(dict):

	def __init__(self):
		self = dict()

	def add(self, key, value):
		self[key] = value

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def sli():
	return list(msi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))

def binary_search(arr, low, high, x):
	if high >= low:
		mid = (high + low) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binary_search(arr, low, mid - 1, x)
		else:
			return binary_search(arr, mid + 1, high, x)
	else:
		return -1

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def padded_bin_with_complement(x):
	if x < 0:
		return bin(2 ** 16 - abs(x))[2:].zfill(16)
	else:
		return bin(x)[2:].zfill(16)

def binaryToDecimal(binary):
	binary1 = binary
	(decimal, i, n) = (0, 0, 0)
	while binary != 0:
		dec = binary % 10
		decimal = decimal + dec * pow(2, i)
		binary = binary // 10
		i += 1
	print(decimal)

def CountFrequency(my_list):
	freq = {}
	for item in my_list:
		if item in freq:
			freq[item] += 1
		else:
			freq[item] = 1
	return freq

def pos(a):
	b = [0] * len(a)
	c = sorted(a)
	for i in range(len(a)):
		for j in range(len(a)):
			if c[j] == a[i]:
				b[i] = j
				break
	return b

def smallestDivisor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i * i <= n:
		if n % i == 0:
			return i
		i += 2
	return n

def commonn(a, b, n):
	c = []
	for i in range(n):
		if a[i] == b[i]:
			c.append('-1')
		else:
			c.append(b[i])
	return c

def find_lcm(num1, num2):
	if num1 > num2:
		num = num1
		den = num2
	else:
		num = num2
		den = num1
	rem = num % den
	while rem != 0:
		num = den
		den = rem
		rem = num % den
	gcd = den
	lcm = int(int(num1 * num2) / int(gcd))
	return lcm

def sumdigit(n):
	n = str(n)
	k = 0
	for i in range(len(n)):
		k += int(n[i])
	return k

def main():
	for _ in range(ii()):
		(a, b) = mi()
		j = abs(a - b)
		res = math.ceil(j / 10)
		print(res)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


a = int(input())
for i in range(a):
	(x, y) = input().split()
	if int(x) == int(y):
		print(0)
	elif int(y) > int(x):
		if (int(y) - int(x)) % 2 == 1:
			print(1)
		else:
			print(2)
	elif (int(y) - int(x)) % 2 == 1:
		print(2)
	else:
		print(1)


t = int(input())
while t > 0:
	t -= 1
	(a, b) = map(int, input().split())
	if b < a:
		temp = a
		a = b
		b = temp
	d = b - a
	c = int(d / 10)
	d = d % 10
	if d > 0:
		c += 1
	print(c)


cases = int(input())
for number in range(cases):
	case = list(map(int, input().strip().split()))
	(a, b) = case
	flag = 2
	temp = 0
	if a < b:
		flag = 0
	if a > b:
		flag = 1
	if flag == 1:
		c = a - b
		if c % 2 == 0:
			temp = 1
		else:
			temp = 2
	elif flag == 0:
		c = b - a
		if c % 2 == 0:
			temp = 2
		else:
			temp = 1
	print(temp)


t = int(input())
for test in range(t):
	(a, b) = [int(x) for x in input().split()]
	m = max(a, b)
	n = min(a, b)
	num = m - n
	ans = num // 10
	if num % 10 != 0:
		ans += 1
	print(ans)


n = int(input())
k = [i for i in range(1, 11)]
for i in range(n):
	count = 0
	(a, b) = list(map(int, input().split()))
	if a == b:
		count = 0
	else:
		diff = abs(b - a)
		if diff >= 10:
			times = diff // 10
			rem = diff % 10
			count += times
			if rem in range(1, 10):
				count += 1
		else:
			count = 1
	print(count)


import sys
import math
input = sys.stdin.readline
n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	ans = 0
	if a <= b:
		if a == b:
			ans = 0
		elif a % 2 == 0 and b % 2 == 1 or (a % 2 == 1 and b % 2 == 0):
			ans = 1
		else:
			ans = 2
		print(ans)
	else:
		if a % 2 == 1 and b % 2 == 1 or (a % 2 == 0 and b % 2 == 0):
			ans = 1
		else:
			ans = 2
		print(ans)


t = int(input())
for i in range(t):
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	if n > k:
		print(int((n - k) / 10 + 1) if (n - k) % 10 != 0 else int((n - k) / 10))
	elif n < k:
		print(int((k - n) / 10 + 1) if (k - n) % 10 != 0 else int((k - n) / 10))
	else:
		print(0)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	ans = (abs(a - b) + 9) // 10
	print(ans)


for test in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		diff = abs(a - b)
		ans = diff // 10
		if diff % 10 == 0:
			print(ans)
		else:
			print(ans + 1)


tc = int(input())
while tc != 0:
	tc = tc - 1
	(a, b) = map(int, input().split())
	if a > b:
		if (a - b) % 2 == 0:
			print('1')
		else:
			print('2')
	elif a < b:
		if (b - a) % 2 == 1:
			print('1')
		else:
			print('2')
	else:
		print('0')


def R():
	return map(int, input().split())

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
from itertools import permutations
import bisect
for _ in range(I()):
	(a, b) = R()
	if a == b:
		print('0')
	if b > a and (b - a) % 2 == 1:
		print('1')
	if b < a and (a - b) % 2 == 0:
		print('1')
	if b > a and (b - a) % 2 == 0:
		print('2')
	if b < a and (a - b) % 2 == 1:
		print('2')


from sys import stdin, stdout
for i in range(int(stdin.readline())):
	(a, b) = map(int, stdin.readline().strip().split())
	if abs(a - b) % 10 == 0:
		print(abs(a - b) // 10)
	else:
		print(abs(a - b) // 10 + 1)


from math import ceil
for _ in range(int(input())):
	X = sorted(list(map(int, input().split())))
	print(ceil((X[-1] - X[0]) / 10))


for i in range(int(input())):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	t = a - b if a > b else b - a
	k = t // 10
	if t % 10 != 0:
		k += 1
	print(k)


try:
	import math
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		count = 0
		if a < b:
			x = (b - a) / 10.0
			c = math.ceil(x)
		else:
			x = (a - b) / 10.0
			c = math.ceil(x)
		print(c)
except:
	pass


import math as ma
t = int(input())
for _ in range(t):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	r = abs(a - b)
	print(ma.ceil(r / 10))


def wrapper(func):

	def inner():
		return next(func)
	return inner
T = int(input())
for case in range(T):
	(a, b) = map(int, input().strip().split())
	if a == b:
		print('0')
	elif a < b:
		print(2 if a & 1 == b & 1 else 1)
	else:
		print(1 if a & 1 == b & 1 else 2)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def integer():
	return int(inp())

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def solve():
	(a, b) = sep()
	k = abs(a - b)
	t1 = k // 10
	t2 = k % 10
	if t2 == 0:
		print(t1)
	else:
		print(t1 + 1)
testcase(int(inp()))


import random

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

def lcm(a, b):
	return a * b / gcd(a, b)
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	k = abs(b - a)
	c = 0
	for i in range(10, 1, -1):
		c += k // i
		k %= i
	if k == 1:
		c += 1
	print(c)


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


n = int(input())
l = []
for _ in range(n):
	count = 0
	t = input().split(' ')
	a = int(t[0])
	b = int(t[1])
	if a > b:
		t = a - b
		if t % 2 == 0:
			count = 1
			l.append(count)
		else:
			count = 2
			l.append(count)
	elif b > a:
		t = a - b
		if t % 2 != 0:
			count = 1
			l.append(count)
		else:
			count = 2
			l.append(count)
	else:
		l.append(count)
for i in l:
	print(i)


t = int(input())
from math import gcd
for _ in range(t):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	ans = x // 10
	if x % 10:
		ans += 1
	print(ans)


import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
input = sys.stdin.readline
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
for _ in range(inin()):
	(a, b) = cin()
	if a == b:
		print(0)
	else:
		d = abs(b - a)
		c = 1 if d % 10 != 0 else 0
		print(d // 10 + c)


import math
import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

def instr():
	s = input()
	return list(s[:len(s) - 1])

def invar():
	return map(int, input().split())

def pba(a, b, m):
	if a == b:
		return m
	if abs(a - b) <= 10:
		return m + 1
	return math.ceil(abs(b - a) / 10)
n = inp()
for i in range(n):
	(a, b) = invar()
	m = 0
	print(pba(a, b, m))


import math
t = int(input())
for x in range(t):
	array = input().split(' ')
	a = int(array[0])
	b = int(array[1])
	moves = 0
	m = 10
	if a == b:
		print(0)
	else:
		if a < b:
			moves = math.ceil((b - a) / 10)
		else:
			moves = math.ceil((a - b) / 10)
		print(moves)


from bisect import bisect_right

def no_op(a: int, b: int) -> int:
	count = -(-abs(a - b) // 10)
	return count
T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split())
	print(no_op(a, b))


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


import math

def BuubleSort(a, b):
	if a == b:
		return 0
	elif a > b and (a - b) % 2 == 0 or (b > a and (b - a) % 2 != 0):
		return 1
	else:
		return 2

def main():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		ans = BuubleSort(a, b)
		print(ans)
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	para = not a & 1
	parb = not b & 1
	if diff == 0:
		print(0)
	elif a < b:
		if para == parb:
			print(2)
		else:
			print(1)
	elif para == parb:
		print(1)
	else:
		print(2)


import math
t = int(input())
while t > 0:
	numbers = list(map(int, input().split()))
	print(math.ceil(abs((numbers[0] - numbers[1]) / 10)))
	t = t - 1


x = int(input())
for i in range(0, x):
	num = input().split()
	if abs(int(num[1]) - int(num[0])) % 10 == 0:
		print(abs(int(num[1]) - int(num[0])) // 10)
	else:
		print(abs(int(num[1]) - int(num[0])) // 10 + 1)


n = int(input())
for _ in range(n):
	(x, y) = map(int, input().split())
	s = y - x
	if not s:
		print(s)
	else:
		print([2, 1][::s // abs(s)][s % 2])


import sys
input = sys.stdin.readline
from operator import mul
from functools import reduce
from sys import stdout

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def solve():
	(a, b) = inlt()
	d = abs(a - b)
	if a == b:
		print(0)
	elif a > b:
		if d % 2 == 0:
			print(1)
		else:
			print(2)
	elif d % 2 == 0:
		print(2)
	else:
		print(1)

def main():
	t = inp()
	while t > 0:
		t = t - 1
		solve()
main()


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	ctr = 0
	diff = abs(b - a)
	if a != b and diff % 10 != 0:
		ctr = 1
	print(diff // 10 + ctr)
	t -= 1


import random
for _ in [0] * int(input()):
	(a, b) = map(int, input().split())
	b -= a
	print(b and ((b < 0) & b | (b > 0) & ~b) + 1)


n = []
for i in range(int(input())):
	n.append(list(map(int, input().split())))
for e in n:
	e.sort()
	if e[1] != e[0]:
		c = 0
		for i in range(10, 0, -1):
			a = (e[1] - e[0]) // i
			if a > 0:
				e[0] += a * i
				c += a
		print(c)
	else:
		print(0)


t = int(input())
while t:
	t -= 1
	(a, b) = list(map(int, input().split()))
	diff = abs(a - b)
	ct = diff / 10
	diff = diff % 10
	if diff > 0:
		ct += 1
	print(int(ct))


def find(a, b):
	if a == b:
		return 0
	val = abs(a - b)
	ans = val % 10
	q = val // 10
	if ans == 0:
		return q
	return q + 1
t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	print(find(a, b))
	t -= 1


import sys

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	(a, b) = get_ints()
	if a == b:
		print(0)
		continue
	if b > a:
		x = (b - a) // 10
		if (b - a) % 10 != 0:
			x += 1
		print(x)
	if a > b:
		(a, b) = (b, a)
		x = (b - a) // 10
		if (b - a) % 10 != 0:
			x += 1
		print(x)


for _ in range(int(input())):
	l = [int(x) for x in input().split(' ')]
	m = max(l)
	n = min(l)
	floor = (m - n - 1) // 10 + 1
	print(floor)


import math

def dtb(n):
	return bin(n).replace('0b', '')

def btd(n):
	return int(n, 2)
t = int(input())
for k in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	x = abs(a - b)
	if x % 10 == 0:
		print(x // 10)
	else:
		print(x // 10 + 1)


t = int(input())
for t in range(t):
	(p, q) = map(int, input().split())
	p1 = abs(q - p)
	x = p1 // 10
	if p1 % 10 != 0:
		print(x + 1)
	else:
		print(x)


t = int(input())
y = t
list1 = []
while t != 0:
	(a, b) = [int(x) for x in input().split()]
	c = abs(a - b)
	sol = int(c / 10)
	if c % 10 == 0:
		list1.append(sol)
	else:
		list1.append(sol + 1)
	t = t - 1
for i in list1:
	print(i)


def countSteps(a, b):
	if a == b:
		return 0
	mx = max(a, b)
	mn = min(a, b)
	count = 0
	dif = mx - mn
	if dif % 10 == 0:
		return int((mx - mn) / 10)
	else:
		return int((mx - mn) / 10) + 1
count = int(input())
for i in range(count):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	print(countSteps(a, b))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if b == a:
		print(0)
	elif b > a:
		answer = 0
		k = (b - a) // 10
		b -= k * 10
		if b == a:
			answer += k
		else:
			answer += k + 1
		print(answer)
	else:
		answer = 0
		k = (a - b) // 10
		b += k * 10
		if b == a:
			answer += k
		else:
			answer += k + 1
		print(answer)


import math
for i1 in range(int(input())):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	y = math.ceil(x / 10)
	print(y)


n = int(input())
for x in range(n):
	(a, b) = map(int, input().strip().split()[:2])
	k = abs(a - b)
	if b > a:
		if k % 2 != 0:
			print(1)
		else:
			print(2)
	elif a > b:
		if k % 2 != 0:
			print(2)
		else:
			print(1)
	else:
		print(0)


import math
import sys
t = int(input())
for cs in range(t):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	ans = (d + 9) // 10
	print(ans)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	ans = (d - 1) // 10 + 1
	print(ans)


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
import sys
letters = ascii_letters
input = stdin.readline
for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	print(abs(a - b) // 10 + (1 if abs(a - b) % 10 != 0 else 0))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	ans = 0
	sub = abs(a - b)
	rem = sub % 10
	ans = sub // 10
	if rem > 0:
		ans += 1
	print(ans)


import math
import sys
imput = sys.stdin.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print('0')
	elif a < b:
		diff = b - a
		if diff % 2:
			print('1')
		else:
			print('2')
	else:
		diff = a - b
		if diff % 2 == 0:
			print('1')
		else:
			print('2')


import sys, bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range
R = range

def Golf():
	(n, *t) = map(int, open(0).read().split())

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def MI():
	return map(int, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def NLI(n):
	return [[int(i) for i in input().split()] for i in range(n)]

def NLI_(n):
	return [[int(i) - 1 for i in input().split()] for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def RA():
	return map(int, open(0).read().split())

def RLI(n=8, a=1, b=10):
	return [random.randint(a, b) for i in range(n)]

def RI(a=1, b=10):
	return random.randint(a, b)

def Rtest(T):
	(case, err) = (0, 0)
	for i in range(T):
		inp = INP()
		(a1, ls) = naive(*inp)
		a2 = solve(*inp)
		if a1 != a2:
			print((a1, a2), inp)
			err += 1
		case += 1
	print('Tested', case, 'case with', err, 'errors')

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in R(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in R(base ** n):
		s = [tb // base ** bt % base for bt in R(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
l_alp = string.ascii_lowercase
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
input = lambda : sys.stdin.readline().rstrip()
show_flg = False
show_flg = True
ans = 0
for _ in range(I()):
	ans = 0
	(a, b) = LI()
	x = abs(b - a)
	ans = (x + 9) // 10
	print(ans)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	k = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
	if a == b:
		print(0)
	else:
		c = 0
		m = abs(a - b)
		if m in k:
			print(1)
		else:
			for i in reversed(k):
				e = m // i
				l = m % i
				if l == 0:
					print(c + e)
					break
				if l in k:
					c += e + 1
					print(c)
					break
				else:
					c += e
					m = l


from sys import stdin
r = stdin.readline

def main():
	cases = int(r())
	for case in range(cases):
		(a, b) = map(int, r().strip().split())
		if a == b:
			print(0)
		elif a > b:
			if (a - b) % 2 == 0:
				print(1)
			else:
				print(2)
		elif a < b:
			if (b - a) % 2 == 1:
				print(1)
			else:
				print(2)
main()


from sys import stdin, stdout
import math
from collections import Counter, deque
L = lambda : list(map(int, stdin.readline().strip().split()))
M = lambda : map(int, stdin.readline().strip().split())
I = lambda : int(stdin.readline().strip())
IN = lambda : stdin.readline().strip()
C = lambda : stdin.readline().strip().split()
mod = 1000000007

def s(a):
	print(' '.join(list(map(str, a))))
for i in range(I()):
	(a, b) = M()
	if a == b:
		print(0)
	elif a > b:
		if (a - b) % 2 == 0:
			print(1)
		else:
			print(2)
	elif (b - a) % 2 == 1:
		print(1)
	else:
		print(2)


import sys
import math
from _collections import defaultdict
input = sys.stdin.readline
t = int(input())

def inar():
	return [int(el) for el in input().split()]
for _ in range(t):
	(a, b) = inar()
	take = max(a, b) - min(a, b)
	print(math.ceil(take / 10))


testcase = int(input())
l = []
for i in range(testcase):
	(a, b) = map(int, input().split())
	l.append((a, b))
for j in l:
	(a, b) = j
	count = 0
	if a - b == 0:
		count = 0
	elif abs(a - b) in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:
		count = 1
	elif b < a:
		if a - b not in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:
			count = count + (a - b) // 10
			b = abs(a - b) % 10
			if b in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:
				count += 1
	elif b > a:
		if b - a not in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:
			count = count + (b - a) // 10
			b = abs(a - b) % 10
			if b in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:
				count += 1
	else:
		pass
	print(count)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split(' '))
	d = abs(a - b)
	if d == 0:
		print(0)
	elif d <= 10 and d > 0:
		print(1)
	else:
		nd = d
		c = 0
		while nd > 10:
			a = nd // 10
			c = c + a
			nd = nd % 10
		if nd > 0:
			print(c + 1)
		else:
			print(c)


def find(a, b):
	diff = b - a
	if diff == 0:
		return 0
	if diff > 0 and diff % 2 == 1 or (-diff > 0 and diff % 2 == 0):
		return 1
	return 2

def main():
	t = int(input())
	while t:
		(a, b) = list(map(int, input().split()))
		print(find(a, b))
		t -= 1
main()


t = int(input())
a = []

def chk(a, b):
	if a == b:
		return 0
	if a > b:
		if a % 2 == 0 and b % 2 == 0:
			return 1
		elif a % 2 == 1 and b % 2 == 1:
			return 1
		elif a % 2 == 0 or b % 2 == 0:
			return 2
	elif a < b:
		if a % 2 == 0 and b % 2 == 0:
			return 2
		elif a % 2 == 1 and b % 2 == 1:
			return 2
		elif a % 2 == 0 or b % 2 == 0:
			return 1
for i in range(t):
	(p, q) = map(int, input().split()[:2])
	a.append(chk(p, q))
for i in a:
	print(i)


from sys import stdin
import math
for _ in range(int(input())):
	(n, k) = map(int, stdin.readline().rstrip().split(' '))
	print(math.ceil(abs(n - k) / 10))


N = int(input())
new = []
for _ in range(N):
	new.append(list(map(int, input().split())))
for i in new:
	t = i[1] - i[0]
	if t == 0:
		print(0)
	elif t > 0:
		if t % 2 == 0:
			print(2)
		else:
			print(1)
	elif t % 2 == 0:
		print(1)
	else:
		print(2)


testcase = int(input())
for i in range(testcase):
	arr = [int(i) for i in input().split()]
	a = arr[0]
	b = arr[1]
	count = 0
	c = abs(a - b)
	d = c // 10
	rem = c % 10
	if rem > 0:
		d += 1
	print(d)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	if b <= 10 and a <= 10:
		print(1)
		continue
	val = abs(b - a)
	check = val % 10
	if check == 0:
		print(val // 10)
	else:
		print(val // 10 + 1)


t = int(input())
for tc in range(1, t + 1):
	(a, b) = map(int, input().split())
	c = 0
	if a == b:
		print(0)
		continue
	if a > b:
		(a, b) = (b, a)
	diff = b - a
	c = diff // 10
	if diff % 10:
		c += 1
	print(c)


def _solve(a, b):
	ans = 0
	if a == b:
		return 0
	d = abs(a - b)
	i = 10
	while i > 0 and d != 0:
		if d >= i:
			temp = d // i
			ans += temp
			d -= i * temp
		i = i - 1
	return ans
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	print(_solve(a, b))


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
from io import BytesIO, IOBase
from bisect import bisect_left

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=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

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 flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

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 prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(ii()):
	(a, b) = mi()
	tmp = b - a
	if tmp > 0:
		if tmp & 1:
			res = 1
		else:
			res = 2
	elif tmp == 0:
		res = 0
	elif tmp & 1:
		res = 2
	else:
		res = 1
	print(res)


for i in range(int(input())):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	raw_res = abs(a - b) // 10
	if a - raw_res * 10 == b or a + raw_res * 10 == b:
		print(raw_res)
	else:
		print(raw_res + 1)


from sys import stdin, stdout

def input():
	a = stdin.readline()
	if a[-1] == '\n':
		a = a[:-1]
	return a

def print(*argv, end='\n', sep=' '):
	n = len(argv)
	for i in range(n):
		if i == n - 1:
			stdout.write(str(argv[i]))
		else:
			stdout.write(str(argv[i]) + sep)
	stdout.write(end)
mod = 10 ** 9 + 7

def lcm(x, y):
	from math import gcd
	return x * y / gcd(x, y)

def comb(lst, x):
	from itertools import combination as c
	return list(comb(lst, x))

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	lst = []
	for i in range(n):
		temp = [default] * m
		lst.append(temp)
	return lst

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}
from math import ceil

def solve(a, b):
	return ceil(abs(a - b) / 10)
for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	print(solve(a, b))


from math import ceil
t = int(input().strip())
for a0 in range(t):
	(a, b) = map(int, input().strip().split())
	print(ceil(abs(a - b) / 10))


t = input()
for i in range(int(t)):
	moves = 0
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	if b - a >= 0:
		diff = b - a
	else:
		diff = a - b
	for r in range(10, 0, -1):
		moves += int(diff / r)
		diff = diff % r
		if diff == 0:
			break
	print(moves)


def read_array():
	x = []
	x1 = []
	x = input()
	x = x.split(' ')
	for r in range(len(x)):
		x1.append(int(x[r]))
	return x1

def find_closer_value(a, b):
	count = 0
	if a == b:
		return 0
	if a > b:
		if a > b and a - 10 > b:
			c = (a - b) // 10
			if (a - b) % 10 == 0:
				count += c
			else:
				count += c + 1
		else:
			count += 1
	elif a < b and a + 10 < b:
		c = (b - a) // 10
		if (b - a) % 10 == 0:
			count += c
		else:
			count += c + 1
	else:
		count += 1
	return count
res = []
m = int(input())
for r in range(m):
	x = read_array()
	res.append(find_closer_value(x[0], x[1]))
for v in res:
	print(v)


T = int(input())
for ab in range(T):
	(a, b) = map(int, input().split())
	if a == b:
		ans = 0
	elif a < b:
		if (b - a) % 2 != 0:
			ans = 1
		else:
			ans = 2
	elif (a - b) % 2 == 0:
		ans = 1
	else:
		ans = 2
	print(ans)


class Solution:

	def solve(self, a, b):
		if a == b:
			return 0
		return (abs(a - b) + 9) // 10
A = Solution()
T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split())
	print(A.solve(a, b))


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	diff = abs(a - b)
	plus_10 = diff // 10
	print(plus_10 + (diff != 10 * plus_10))


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


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	c = 0
	while a != b:
		if a < b:
			dif = b - a
			if dif >= 10:
				k = dif // 10
				a += 10 * k
				c += k
			else:
				a += dif
				c += 1
		else:
			dif = a - b
			if dif >= 10:
				k = dif // 10
				a = a - 10 * k
				c += k
			else:
				a -= dif
				c += 1
	print(c)


import math
numQuery = int(input())
for i in range(numQuery):
	numbers = list(map(int, input().split()))
	a = numbers[0]
	b = numbers[1]
	diff = abs(a - b)
	print(math.ceil(diff / 10))


t = int(input())
while t > 0:
	n = input()
	data = n.split(' ')
	a = int(data[0])
	b = int(data[1])
	if a == b:
		print('0')
	elif a > b and (a - b) % 2 == 0:
		print('1')
	elif a < b and (b - a) % 2 == 1:
		print('1')
	else:
		print('2')
	t -= 1


case = int(input())
for i in range(case):
	(a, b) = (int(v) for v in input().split())
	if a == b:
		print(0)
	elif a > b:
		if a % 2 == b % 2:
			print(1)
		else:
			print(2)
	elif a % 2 == b % 2:
		print(2)
	else:
		print(1)


import sys
import math
tests = int(input())
for i in range(tests):
	(a, b) = [int(i) for i in input().split()]
	diff = abs(a - b)
	moves = 0
	for i in range(10, 0, -1):
		move = diff // i
		moves += move
		diff -= move * i
		if diff == 0:
			break
	print(moves)


t = int(input())
test_cases = [input() for i in range(t)]

def solve(test_case):
	(a, b) = map(int, test_case.split())
	if a == b:
		print(0)
	elif a > b:
		if (a - b) % 2 == 0:
			print(1)
		else:
			print(2)
	elif (a - b) % 2 == 0:
		print(2)
	else:
		print(1)
for test_case in test_cases:
	solve(test_case)


import math as mt
import sys, string
from collections import Counter, defaultdict
input = sys.stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
ARR = lambda : list(map(int, input().split()))

def main():
	(a, b) = M()
	diff = abs(a - b)
	if diff % 10 == 0:
		print(diff // 10)
	else:
		print(diff // 10 + 1)
tc = I()
for _ in range(tc):
	main()


def numbers(a, b):
	return (abs(a - b) + 9) // 10
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(numbers(a, b))


import sys
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
for _ in range(inp()):
	(a, b) = inpl()
	(a, b) = (max(a, b), min(a, b))
	print((a - b + 9) // 10)


def A1311(a, b):
	if a == b:
		return 0
	elif b > a:
		if (a - b) % 2 == 1:
			return 1
		else:
			return 2
	elif (a - b) % 2 == 0:
		return 1
	else:
		return 2
t = int(input())
L = [[0, 0]] * t
for i in range(0, t):
	L[i] = [int(k) for k in input().split()]
for i in range(0, t):
	print(A1311(L[i][0], L[i][1]))


T = int(input())
for _ in range(T):
	(A, B) = map(int, input().split())
	if A < B:
		if (B - A) % 2 != 0:
			print(1)
		else:
			print(2)
	elif A > B:
		if (A - B) % 2 != 0:
			print(2)
		else:
			print(1)
	else:
		print(0)


n = int(input())
result = []
for _ in range(n):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	if a == b:
		result.append(0)
	elif a < b:
		if abs(a - b) % 2 == 0:
			result.append(2)
		else:
			result.append(1)
	elif abs(a - b) % 2 == 0:
		result.append(1)
	else:
		result.append(2)
for item in result:
	print(item)


t = int(input())
a = []
for i in range(t):
	b = list(map(int, input().split()))
	a.append(b)
for i in a:
	c = i[0]
	d = i[1]
	if d > c:
		if (d - c) % 2 != 0:
			print(1)
		else:
			print(2)
	elif d < c:
		if (c - d) % 2 == 0:
			print(1)
		else:
			print(2)
	else:
		print(0)


def make_a_b(a, b):
	if b - a > 0:
		if (b - a) % 2 != 0:
			return 1
		else:
			return 2
	elif b - a < 0:
		if (b - a) % 2 == 0:
			return 1
		else:
			return 2
	else:
		return 0
t = int(input())
for t_itr in range(t):
	arr = list(map(int, input().rstrip().split()))
	a = int(arr[0])
	b = int(arr[1])
	result = make_a_b(a, b)
	print(result)


t = int(input())
for i in range(t):
	ans = 0
	x = [int(i) for i in input().split()]
	a = x[0]
	b = x[1]
	if a == b:
		ans = 0
	p = abs(b - a)
	if b > a:
		if p % 2 != 0:
			ans = 1
		if p % 2 == 0:
			ans = 2
	if a > b:
		if p % 2 == 0:
			ans = 1
		if p % 2 != 0:
			ans = 2
	print(ans)


test = int(input())
for t in range(test):
	(a, b) = map(int, input().split())
	k = abs(a - b)
	if k == 0:
		print(0)
	elif k % 10 == 0:
		print(k // 10)
	else:
		print(k // 10 + 1)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b) = [int(i) for i in input().split()]
	ans = abs(b - a) // 10 + ((b - a) % 10 != 0)
	print(ans)


def diffrence(a, b):
	a = abs(b - a)
	if a <= 10:
		if a == 0:
			result = 0
		else:
			result = 1
	else:
		result = a // 10
		if a % 10 == 0:
			result += 0
		else:
			result += 1
	return result
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(diffrence(a, b))


n = int(input())
a = []
for i in range(n):
	a.append(list(input().split()))
for i in range(n):
	m = 0
	x = int(a[i][0]) - int(a[i][1])
	if x > 0:
		if x % 2 == 0:
			print('1')
		else:
			print('2')
	elif x < 0:
		if x % 2 == 0:
			print('2')
		else:
			print('1')
	else:
		print('0')


t = int(input())
l = []
while t != 0:
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if abs(b - a) == 0:
		print(0)
	elif abs(b - a) % 10 == 0:
		print(abs(b - a) // 10)
	else:
		print(abs(b - a) // 10 + 1)
	t -= 1
for i in range(len(l)):
	print(l[i])


n = int(input())
for i in range(1, n + 1):
	(a, b) = map(int, input().split())
	if a == b:
		print('0')
	elif a == 0 and b != 0 and (b <= 10):
		print('1')
	elif b == 0 and a != 0 and (a <= 10):
		print('1')
	else:
		m = a - b
		if m < 0:
			m = -m
		x = m
		m = m // 10
		if m != 0 and x % 10 == 0:
			print(m)
		else:
			print(m + 1)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = int(pow(10, 9) + 7)
mod2 = 998244353

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

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('../output.txt', 'w')
except:
	pass
for _ in range(L()[0]):
	(a, b) = L()
	if a == b:
		print(0)
	elif a > b and (a - b) % 2 == 0:
		print(1)
	elif a < b and (b - a) % 2:
		print(1)
	else:
		print(2)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	k = abs(a - b)
	move = k // 10
	if k % 10:
		move += 1
	print(move)


cases = int(input())
lines = []
for i in range(cases):
	line = input()
	line_vector = line.split(' ')
	a = int(line_vector[0])
	b = int(line_vector[1])
	lines.append([a, b])
for i in range(cases):
	a = lines[i][0]
	b = lines[i][1]
	counter = 0
	while a != b:
		if a < b:
			x = b - a
			if x % 2 == 0:
				x -= 1
			a += x
		else:
			y = a - b
			if y % 2 != 0:
				y += 1
			a -= y
		counter += 1
	print(counter)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	val = abs(a - b)
	moves = val // 10 + min(val % 10, 1)
	print(moves)


def mi():
	return map(int, input().split())

def li():
	return list(mi())

def ii():
	return int(input())

def si():
	return input()
t = ii()
while t:
	t -= 1
	(a, b) = mi()
	if a < b:
		if (b - a) % 2:
			print('1')
		else:
			print('2')
	elif a == b:
		print('0')
	elif (a - b) % 2:
		print('2')
	else:
		print('1')


t = int(input())
answer = []
for t in range(t):
	(a, b) = list(map(int, input().split(' ')))
	difference = abs(a - b)
	answer.append(str(difference // 10 + (difference % 10 > 0) * 1))
print('\n'.join(answer))


t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	s = abs(a - b) // 10
	if (a - b) % 10 != 0:
		s += 1
	print(s)


import sys
sys.setrecursionlimit(10 ** 6)
fastinput = sys.stdin.readline
fastoutput = sys.stdout.write
for t in range(int(input())):
	(a, b) = map(int, input().split())
	c = abs(b - a)
	if c % 10 == 0:
		print(c // 10)
	else:
		print(c // 10 + 1)


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		sum = abs(a - b)
		r = sum % 10
		di = sum // 10
		if r == 0:
			print(di)
		else:
			print(di + 1)
	t -= 1


t = int(input())
ls = []
for i in range(t):
	(a, b) = map(int, input().split())
	if a < b:
		sub = b - a
		if sub % 2 == 0:
			rs = 2
		else:
			rs = 1
	elif a > b:
		sub = a - b
		if sub % 2 == 0:
			rs = 1
		else:
			rs = 2
	else:
		rs = 0
	ls.append(rs)
for o in ls:
	print(o)


def main():
	t = int(input())
	data = []
	for i in range(t):
		data.append(list(map(int, input().split())))
	for i in range(t):
		x = abs(data[i][0] - data[i][1])
		rem = x % 10
		if rem > 0:
			rem = 1
		if x == 0:
			print(0)
		else:
			print(rem + x // 10)
main()


from sys import stdin, stdout
import math
t = int(stdin.readline())
for _ in range(t):
	(a, b) = map(int, stdin.readline().split())
	val = abs(a - b)
	movs = 0
	if val == 0:
		print(0)
	elif val % 10 == 0:
		print(val // 10)
	else:
		print(val // 10 + 1)


for num in range(int(input())):
	inp = list(map(int, input().split()))
	if abs(inp[0] - inp[1]) % 10 == 0:
		print(int(abs(inp[0] - inp[1]) / 10))
	else:
		print(int(abs(inp[0] - inp[1]) / 10) + 1)


t = int(input())
answer = []
for a in range(t):
	line = input().split()
	a = int(line[0])
	b = int(line[1])
	if a == b:
		answer.append(0)
	else:
		ans = 0
		if abs(a - b) % 10 == 0:
			ans = abs(a - b) // 10
		else:
			ans = abs(a - b) // 10
			ans += 1
		answer.append(ans)
for b in answer:
	print(str(b))


input = __import__('sys').stdin.readline
print = __import__('sys').stdout.write
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print('0\n')
		continue
	if b > a:
		if (b - a) % 2 == 0:
			print('2\n')
		else:
			print('1\n')
	elif (a - b) % 2 == 0:
		print('1\n')
	else:
		print('2\n')


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


T = int(input())
for t in range(T):
	(n, m) = map(int, input().split())
	print((not abs(n - m) % 10 == 0) + abs(n - m) // 10)


lst = []
for i in range(int(input())):
	lst.append(input().split(' '))
for nums in lst:
	if nums[0] == nums[1]:
		print(0)
		continue
	nums[0] = int(nums[0])
	nums[1] = int(nums[1])
	t = nums[0] - nums[1]
	if t > 0:
		if t % 2 != 0:
			print(2)
		else:
			print(1)
	elif t % 2 != 0:
		print(1)
	else:
		print(2)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	l = 0
	r = max(a, b)

	def ok(m):
		global a, b
		if a < b:
			if a + m * 10 >= b:
				return False
			else:
				return True
		elif a > b:
			if a - m * 10 <= b:
				return False
			else:
				return True
	while r - l > 1:
		m = (r + l) // 2
		if ok(m):
			l = m
		else:
			r = m
	if a != b:
		print(l + 1)
	else:
		print(0)


a = input()
a = int(a)
for i in range(a):
	inputt = input()
	inputt = inputt.split()
	az = int(inputt[1]) - int(inputt[0])
	if az == 0:
		print('0')
	if az < 0:
		if az % 2 == 0:
			print('1')
		else:
			print('2')
	if az > 0:
		if az % 2 == 0:
			print('2')
		else:
			print('1')


from sys import stdin, stdout
cases = int(stdin.readline())
for i in range(cases):
	ans = 0
	(a, b) = map(int, stdin.readline().split())
	k = abs(a - b)
	ans = k // 10
	if k % 10 != 0:
		ans += 1
	stdout.write(str(ans) + '\n')


t = int(input())
for i in range(t):
	ti = list(map(int, input().split()))
	a = ti[0]
	b = ti[1]
	ab = abs(a - b)
	if a == b:
		print(0)
	else:
		if a < b:
			if ab % 2 != 0:
				print(1)
			else:
				print(2)
		if a > b:
			if ab % 2 != 0:
				print(2)
			else:
				print(1)


n = int(input())
for n in range(n):
	data = list(map(int, input().strip().split()))
	diff = data[1] - data[0]
	c = 0
	if diff > 0:
		if diff % 2 == 0:
			c += 2
		else:
			c += 1
	elif diff < 0:
		if abs(diff) % 2 == 0:
			c += 1
		else:
			c += 2
	print(c)


for j in range(int(input())):
	(a, b) = map(int, input().split())
	c = abs(b - a)
	l = c // 10
	if c % 10 != 0:
		l += 1
	print(l)


t = int(input())
for i in range(t):
	count = 0
	ab = input().split()
	a = int(ab[0])
	b = int(ab[1])
	if a == b:
		print(0)
		continue
	elif a < b:
		k = b - a
	else:
		k = a - b
	count = k / 10
	if k % 10 != 0:
		count += 1
	print(int(count))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	p = abs(b - a)
	f = p // 10
	g = p % 10
	if g != 0:
		g = 1
	print(abs(f) + g)


try:
	t = int(input())
	while t != 0:
		(a, b) = map(int, input().split())
		p = abs(b - a)
		if p % 10 == 0:
			print(p // 10)
		else:
			print(p // 10 + 1)
		t = t - 1
except EOFError:
	print(' ')


t = int(input())
while t > 0:
	(x, y) = [int(x) for x in input().split()]
	if y > x:
		diff = y - x
		if diff == 0:
			print('0')
		elif diff % 2 == 0:
			print('2')
		else:
			print('1')
	else:
		diff = x - y
		if diff == 0:
			print('0')
		elif diff % 2 == 0:
			print('1')
		else:
			print('2')
	t = t - 1


from sys import stdin, stdout, setrecursionlimit
import heapq
from math import gcd, ceil, sqrt
from collections import Counter, deque
from bisect import bisect_left, bisect_right
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
setrecursionlimit(100000)
mod = 1000000007
tc = ii1()
for _ in range(tc):
	(a, b) = iia()
	diff = abs(a - b)
	res = diff // 10
	if diff % 10:
		res += 1
	print(res)


def integers(a, b):
	n = 10
	count = 0
	if a != b:
		diff = abs(a - b)
		while n > 0:
			count += diff // n
			diff = diff % n
			n -= 1
			if diff == 0:
				return count
	else:
		return 0

def main():
	res = []
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		res.append(integers(a, b))
	for i in res:
		print(i)
main()


def ans(a, b):
	k = abs(a - b)
	temp = k % 10
	ans = k // 10
	return ans + 1 if temp > 0 else ans
T = int(input())
for i in range(T):
	(a, b) = map(int, input().strip().split(' '))
	print(ans(a, b))


n = int(input())
games = []
for _ in range(n):
	games.append([int(x) for x in input().split()])
res = [0] * n
for (i, game) in enumerate(games):
	total = 0
	(g0, g1) = (game[0], game[1])
	while g0 != g1:
		total += 1
		dist = abs(g0 - g1)
		if dist % 2 == 0 and g0 > g1:
			g0 -= dist
		elif dist % 2 == 0 and g0 < g1:
			g0 += dist - 1
		elif dist % 2 != 0 and g0 < g1:
			g0 += dist
		elif dist % 2 != 0 and g0 > g1:
			g0 -= dist + 1
	res[i] = total
for _ in res:
	print(_)


T = int(input())
for i in range(0, T):
	(a, b) = map(int, input().split())
	print((abs(a - b) + 9) // 10)


for t in range(int(input())):
	n = list(input().split())
	a = int(n[0])
	b = int(n[1])
	if a == b:
		print(0)
	elif a < b:
		dif = b - a
		if dif % 2 == 0:
			print(2)
		else:
			print(1)
	else:
		dif = a - b
		if dif % 2 == 0:
			print(1)
		else:
			print(2)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions
from collections import deque, defaultdict, OrderedDict
from fractions import Fraction
from decimal import Decimal

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(ri()):
		(a, b) = ria()
		c = abs(a - b)
		ans = c // 10
		if c % 10 != 0:
			ans += 1
		print(ans)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


t = int(input())
while t > 0:
	(p, q) = input().split()
	a = int(p)
	b = int(q)
	c = b - a
	m = 0
	if c == 0:
		m = 0
	elif c > 0 and c % 2 != 0:
		m = 1
	elif c > 0 and c % 2 == 0:
		m = 2
	elif c < 0 and c % 2 == 0:
		m = 1
	elif c < 0 and c % 2 != 0:
		m = 2
	print(m)
	t = t - 1


n = int(input())
l = []
for i in range(n):
	ll = input().split()
	k = int(ll[1]) - int(ll[0])
	if k == 0:
		l.append(0)
	elif k > 0:
		if k % 2 == 0:
			l.append(2)
		else:
			l.append(1)
	elif k % 2 == 0:
		l.append(1)
	else:
		l.append(2)
for i in l:
	print(i)


import math
testCases = int(input())
for _ in range(testCases):
	(a, b) = map(int, input().split())
	if b > a:
		number = abs(b - a)
		if number % 2 != 0:
			print(1)
		else:
			print(2)
	elif b < a:
		number = abs(b - a)
		if number % 2 != 0:
			print(2)
		else:
			print(1)
	else:
		print(0)


def Solve(a, b):
	if a == b:
		return 0
	k = abs(a - b)
	return k // 10 if k % 10 == 0 else k // 10 + 1
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(Solve(a, b))


def my_fun(c):
	cc = 0
	if c % 10 == 0:
		c = int(c // 10)
		cc = c
	else:
		c = int(c // 10)
		cc = c + 1
	return cc
t = int(input())
while t > 0:
	t -= 1
	(a, b) = input().split()
	aa = int(a)
	bb = int(b)
	c = 0
	diff = 0
	cc = 0
	vv = 0
	if aa == bb:
		print(0)
	else:
		if aa > bb:
			c = aa - bb
			vv = my_fun(c)
		elif bb > aa:
			c = bb - aa
			vv = my_fun(c)
		print(vv)


t = int(input())
res = []
for i in range(t):
	l = list(map(int, input().split()))
	d = abs(l[1] - l[0])
	if d % 10 == 0:
		n = d // 10
	else:
		n = d // 10 + 1
	res.append(n)
for i in res:
	print(i)


from math import ceil

def solve():
	(a, b) = map(int, input().split())
	print(ceil(abs(a - b) / 10))
t = int(input())
for i in range(t):
	solve()


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	moves = 0
	if a != b:
		diff = abs(a - b)
		moves = (diff + 9) // 10
	print(moves)


flag = 0
zz = []
n = int(input())
for i in range(n):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	while a != b:
		if a > b:
			temp = a - b
			if temp % 2 == 0:
				a = a - temp
				flag = flag + 1
			if temp % 2 != 0:
				a = a + temp
				flag = flag + 1
		elif a < b:
			temp = b - a
			if temp % 2 == 0:
				a = a + temp - 1
				flag = flag + 1
			elif temp % 2 != 0:
				a = a + temp
				flag = flag + 1
	zz.append(flag)
	flag = 0
print(*zz, sep='\n')


t = int(input())
for _ in range(t):
	turns = 0
	(a, b) = (int(x) for x in input().split(' '))
	while a != b:
		diff = b - a
		if diff > 0 and diff % 2 != 0:
			a += diff
		elif diff > 0 and diff % 2 == 0:
			a += diff - 1
		elif diff < 0 and diff % 2 != 0:
			a += diff - 1
		elif diff < 0 and diff % 2 == 0:
			a += diff
		turns += 1
	else:
		print(turns)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	move_count = 0
	while not a == b:
		if b > a:
			x = b - a
			if x % 2 == 0:
				a = a + 1
			else:
				a = a + x
		else:
			x = a - b
			if x % 2 == 0:
				a = a - x
			else:
				a = a + 1
		move_count = move_count + 1
	print(move_count)


from collections import Counter, defaultdict, deque
import sys
input = sys.stdin.readline

def solve():
	(a, b) = [int(x) for x in input().split()]
	ans = abs(b - a)
	print((ans % 10 != 0) + ans // 10)
tt = int(input())
for test in range(tt):
	solve()


t = int(input())
answers = []
for i in range(t):
	l = [int(x) for x in input().split()]
	(a, b) = l
	x = abs(b - a)
	ctr = 0
	while x:
		for j in range(10, 0, -1):
			if x != 0:
				ctr += x // j
			x -= x // j * j
	answers.append(ctr)
for a in answers:
	print(a)


t = int(input())
for _ in range(t):
	(a, b) = tuple(map(int, input().split()))
	x = abs(b - a)
	q = x // 10
	r = x % 10
	if r == 0:
		print(q)
	else:
		print(q + 1)


from math import ceil
t = int(input())
while t > 0:
	t = t - 1
	_ = input().split()
	a = int(_[0])
	b = int(_[1])
	print(ceil(abs(a - b) / 10))


def get_input_data() -> list:
	i = 0
	t = int(input())
	data = []
	while i < t:
		inp = input()
		data.append([int(e) for e in inp.split()])
		i += 1
	return data
data: list = get_input_data()
for (a, b) in data:
	v = b - a
	if v == 0:
		print('0')
	elif v > 0:
		if v % 2 == 0:
			print('2')
		else:
			print('1')
	elif v < 0:
		if v % 2 == 0:
			print('1')
		else:
			print('2')


def countmany(n):
	l = [list(map(int, input().split(' '))) for _ in range(n)]
	for i in l:
		print((abs(i[0] - i[1]) + 9) // 10)
n = input()
countmany(int(n))


t = int(input())
for i in range(1, t + 1):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	q = abs(a - b)
	dem = 0
	so10 = q // 10
	q = q % 10
	dem = dem + so10
	if q != 0:
		dem = dem + 1
	print(dem)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	diff = abs(a - b)
	temp = diff // 10
	temp_1 = diff % 10
	if temp_1 == 0:
		print(temp)
	else:
		print(temp + 1)


testCase = int(input())
while testCase != 0:
	testCase -= 1
	(a, b) = [int(x) for x in input().split()]
	difference = abs(a - b)
	result = int(difference / 10)
	if difference % 10 != 0:
		result += 1
	print(result)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	if a > b:
		(b, a) = (a, b)
	target = b - a
	if target <= 10 and target >= 1:
		print(1)
		continue
	elif target % 10 == 0:
		print(target // 10)
	else:
		print(target // 10 + 1)


from math import ceil
n = int(input())
for i in range(n):
	line = input().split(' ')
	a = int(line[0])
	b = int(line[1])
	m = abs(a - b)
	print(ceil(m / 10.0))


from sys import stdin, stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()
for _ in range(int(I1())):
	(a, b) = I()
	c = abs(a - b)
	if c % 10 == 0:
		print(c // 10)
	else:
		print(c // 10 + 1)


import math
for tc in range(int(input())):
	nx = list(map(int, input().split()))
	n = nx[0]
	x = nx[1]
	print(math.ceil(abs(n - x) / 10))


import sys
import math
import collections
import heapq
import queue
import itertools
import functools
import operator
import time
readline = sys.stdin.readline
IPS = lambda : readline().rstrip()
IP = lambda : int(readline().rstrip())
MP = lambda : map(int, readline().split())
LS = lambda : list(map(int, readline().split()))

def solve():
	for _ in range(IP()):
		(a, b) = MP()
		mx = abs(a - b)
		ans = int(mx / 10)
		if mx % 10 != 0:
			ans += 1
		print(ans)
solve()


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


from math import ceil
from collections import deque
for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	print(ceil(abs(b - a) / 10))


t = int(input())
while t:
	user_input = list(map(int, input().split()))
	if user_input[0] == user_input[1]:
		print(0)
		t -= 1
		continue
	elif user_input[0] < user_input[1]:
		target = user_input[1] - user_input[0]
	else:
		target = user_input[0] - user_input[1]
	if target <= 10:
		print(1)
	else:
		solution = 0
		while target:
			rem = target % 10
			solution = solution + target // 10
			target = rem
			if target == 0:
				print(solution)
				break
			elif target <= 10:
				print(solution + 1)
				break
	t -= 1


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	(ten, num) = divmod(abs(a - b), 10)
	print(ten + bool(num))


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


test_cases = int(input())
for test_case in range(test_cases):
	(a, b) = list(map(int, input().split()))
	diff = abs(a - b)
	ans = diff // 10
	if diff == 0:
		ans = 0
	elif ans == 0 and diff != 0:
		ans = 1
	elif ans * 10 < diff:
		ans += 1
	print(ans)


t = int(input(''))
arr = []
for i in range(t):
	arr.append(list(map(int, input().split())))
for i in arr:
	a = i[0]
	b = i[1]
	diff = abs(b - a)
	sol = diff / 10
	if sol == int(sol):
		print(int(sol))
	else:
		print(int(sol) + 1)


t = int(input())
while t > 0:
	t = t - 1
	s = input()
	l = s.split()
	a = int(l[0])
	b = int(l[1])
	if a == b:
		print(0)
	elif b > a:
		if b % 2 == 0 and a % 2 == 0:
			print(2)
		elif b % 2 == 0 and a % 2 != 0:
			print(1)
		elif b % 2 != 0 and a % 2 == 0:
			print(1)
		else:
			print(2)
	elif b % 2 == 0 and a % 2 == 0:
		print(1)
	elif b % 2 == 0 and a % 2 != 0:
		print(2)
	elif b % 2 != 0 and a % 2 == 0:
		print(2)
	else:
		print(1)


import math
test = int(input())
for _ in range(test):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	value = math.ceil(diff / 10)
	print(value)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	diff = abs(b - a)
	op = 0
	i = 10
	while diff and i:
		op += diff // i
		diff = diff % i
		i -= 1
	print(op)


import math
for _ in range(int(input())):
	(m, n) = sorted(list(map(int, input().split())))
	if m == n:
		print(0)
	else:
		print(math.ceil((n - m) / 10))


local = False
if local:
	file = open('A.txt', 'r')

def IN():
	if local:
		return file.readline()
	else:
		return input()

def solve(a, b):
	if a == b:
		return 0
	diff = b - a
	if diff % 2 != 0:
		if diff > 0:
			return 1
		else:
			return 2
	elif diff < 0:
		return 1
	else:
		return 2
t = int(IN())
for i in range(t):
	(a, b) = [int(n) for n in IN().split()]
	print(solve(a, b))


t = int(input())
from math import ceil
for _ in range(t):
	a = list(map(int, input().split()))
	print(ceil(abs(a[0] - a[1]) / 10))


from sys import stdin, stdout, exit as sys_ret
(f_input, f_print, f_flush) = (stdin.readline, stdout.write, stdout.flush)
for _ in range(int(f_input())):
	(a, b) = map(int, f_input().split())
	if a == b:
		f_print('0\n')
	elif a > b:
		if (a - b) % 2 == 0:
			f_print('1\n')
		else:
			f_print('2\n')
	elif (b - a) % 2 == 1:
		f_print('1\n')
	else:
		f_print('2\n')


import sys
t = int(sys.stdin.readline().strip())
for i in range(t):
	(a, b) = map(int, sys.stdin.readline().strip().split())
	if a == b:
		sys.stdout.write('0\n')
	elif b < a:
		if (a - b) % 2 == 0:
			sys.stdout.write('1\n')
		else:
			sys.stdout.write('2\n')
	elif (b - a) % 2 == 0:
		sys.stdout.write('2\n')
	else:
		sys.stdout.write('1\n')


t = int(input())
for i in range(t):
	ints = input().split()
	a = int(ints[0])
	b = int(ints[1])
	aodd = a % 2 == 1
	bodd = b % 2 == 1
	sp = aodd and bodd or not (aodd or bodd)
	if a == b:
		print('0')
	elif a > b:
		if sp:
			print('1')
		else:
			print('2')
	elif sp:
		print('2')
	else:
		print('1')


import math
numab = []
for i in range(int(input())):
	numab.append(input().split(' '))
for i in numab:
	a = int(i[0])
	b = int(i[1])
	max1 = b
	min1 = a
	if a > b:
		max1 = a
		min1 = b
	if max1 - min1 == 0:
		print(0)
	else:
		print(math.ceil((max1 - min1) / 10))


x = []
a = int(input())
for i in range(0, a):
	(c, d) = map(int, input().split(' '))
	if c > d:
		n = d
		d = c
		c = n
	if d - c == 0:
		x.append(0)
	if int(d) - int(c) != 0:
		e = d - c
		f = int(e / 10)
		if e % 10 > 0:
			f = f + 1
		x.append(f)
for i in range(0, len(x)):
	print(x[i])


import collections
from functools import lru_cache
import bisect
INF = float('inf')
NEG_INF = float('inf')
ZERO = 0
ONE = 1

def read():
	return input().strip()

def readInt():
	return int(input().strip())

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

def solve(a, b):
	diff = abs(a - b)
	return diff // 10 + int(diff % 10 != 0)
t = readInt()
for i in range(t):
	(a, b) = readList()
	print(solve(a, b))


def Input():
	Str = input('')
	List = Str.split(' ')
	for i in range(len(List)):
		List[i] = int(List[i])
	return List

def Function(a, b):
	Count = 0
	N = abs(a - b) / 10
	Count += int(N)
	if N != int(N):
		Count += 1
	return Count
trials = int(input(''))
for i in range(trials):
	[a, b] = Input()
	print(Function(a, b))


t = int(input())
r = 0
while r < t:
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if a > b:
		if (a - b) % 10 == 0:
			print((a - b) // 10)
		else:
			print((a - b) // 10 + 1)
	elif (b - a) % 10 == 0:
		print((b - a) // 10)
	else:
		print((b - a) // 10 + 1)
	r = r + 1


n = int(input())
no_of_lines = n
lines = ''
for i in range(no_of_lines):
	lines += input() + '\n'
templines = lines.split('\n')
temparr = [list(map(int, templines[i].split(' '))) for i in range(n)]
for i in range(no_of_lines):
	x = temparr[i][0]
	y = temparr[i][1]
	if x == y:
		print('0')
	if y - x > 0:
		if (y - x) % 2 == 0:
			print('2')
		else:
			print('1')
	if y - x < 0:
		if (y - x) % 2 == 0:
			print('1')
		else:
			print('2')


try:
	t = int(input())
	for i in range(t):
		(a, b) = map(int, input().split())
		c = abs(a - b)
		d = c // 10
		if c % 10 > 0:
			d += 1
		print(d)
except:
	pass


def checker(a, b):
	d = abs(a - b)
	if d == 0:
		return 0
	elif b - a > 0:
		if d % 2 != 0:
			return 1
		else:
			return 2
	elif b - a < 0:
		if d % 2 != 0:
			return 2
		else:
			return 1
for _ in range(int(input())):
	(A, B) = [int(i) for i in input().split()]
	print(checker(A, B))


a = int(input())
for i in range(a):
	(b, c) = map(int, input().split())
	dist = abs(b - c)
	if b == c:
		print('0')
	else:
		print((dist + 9) // 10)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	k = abs(a - b)
	c = 0
	i = 10
	while k > 0:
		c += int(k / i)
		k = k % i
		i -= 1
	print(c)


t = int(input())
ans = []
for k in range(t):
	(a, b) = map(int, input().split())
	d = abs(b - a)
	q = d // 10
	if d % 10 == 0:
		y = 0
	else:
		y = 1
	ans.append(q + y)
for i in ans:
	print(i)


from math import *
sInt = lambda : int(input())
mInt = lambda : map(int, input().split())
lInt = lambda : list(map(int, input().split()))
t = sInt()
for _ in range(t):
	(a, b) = mInt()
	if abs(b - a) % 10 == 0:
		print(abs(b - a) // 10)
	else:
		print(abs(b - a) // 10 + 1)


import io
import os
from collections import Counter, defaultdict, deque

def solve(A, B):
	diff = abs(A - B)
	if diff == 0:
		return 0
	return (diff + 9) // 10
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
TC = int(input())
for tc in range(1, TC + 1):
	(A, B) = [int(x) for x in input().split()]
	ans = solve(A, B)
	print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	abss = max(a, b) - min(a, b)
	moves = abss // 10
	if abss % 10 != 0:
		moves += 1
	print(moves)


def Integers(a, b):
	diff = abs(a - b)
	d = diff // 10
	rem = diff % 10
	if rem != 0:
		d += 1
	return d
t = int(input())
for i in range(t):
	(a, b) = tuple(map(int, input().split()))
	print(Integers(a, b))


t = int(input())
while t > 0:
	(n, m) = input().split()
	a = int(n)
	b = int(m)
	k = 10
	ans = 0
	a = abs(b - a)
	while a > 0:
		p = a // k
		a = a % k
		if p == 0:
			k -= 1
		else:
			ans += p
	print(ans)
	t -= 1


import math
t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	ans = diff // 10
	if diff % 10 != 0:
		ans += 1
	print(ans)
	t -= 1


cases = int(input())
for i in range(cases):
	(a, b) = map(int, input().split())
	dif = abs(a - b)
	q = int(dif / 10)
	d = dif % 10
	if d == 0:
		print(q)
	else:
		print(q + 1)


n = int(input())
p = []
for i in range(n):
	(a, b) = map(int, input().split())
	S = abs(a - b)
	if S % 10 == 0:
		p.append(str(S // 10))
	else:
		p.append(str(S // 10 + 1))
print('\n'.join(p))


for _ in ' ' * int(input()):
	(a, b) = map(int, input().split())
	z = abs(a - b)
	s = 0
	for i in range(10, 0, -1):
		if z:
			k = z // i
			s += k
			z -= k * i
	print(s)


n = int(input())
x = []
ans = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if a > b:
		g = a - b
		if g % 2 == 0:
			a -= g
			ans = 1
			x.append(ans)
		else:
			a -= g - 2
			a -= 2
			ans = 2
			x.append(ans)
	elif a == b:
		ans = 0
		x.append(ans)
	elif b > a:
		g = b - a
		if g % 2 == 0:
			a += g - 1
			a += 1
			ans = 2
			x.append(ans)
		else:
			a += g
			ans = 1
			x.append(ans)
for i in range(len(x)):
	print(x[i])


import math, sys
from collections import defaultdict, Counter, deque
INF = float('inf')
MOD = 10 ** 9 + 7

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactors(n):
	factors = defaultdict(int)
	i = 2
	while i ** 2 <= n:
		while n % i == 0:
			factors[i] += 1
			n //= i
		i += 1
	if n > 1:
		factors[n] += 1
	return factors

def vars():
	return map(int, input().split())

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

def a():
	(a, b) = map(int, input().split())
	ans = math.ceil(abs(b - a) / 10)
	print(ans)

def b():
	(a, b, x, y, n) = vars()
	(n1, n2) = (n, n)
	a1 = a - min(a - x, n)
	b2 = b - min(b - y, n)
	n1 -= a - a1
	n2 -= b - b2
	b1 = b - min(b - y, n1)
	a2 = a - min(a - x, n2)
	print(min(a1 * b1, a2 * b2))

def c():
	(n, x, y) = vars()
	diff = None
	ans = None
	for d in range(1, y - x + 1):
		arr = []
		num = x
		while num <= y:
			arr.append(num)
			num += d
		if len(arr) <= n and x in arr and (y in arr):
			diff = d
			break
	for start in range(1, x + 1):
		ans = []
		num = start
		for i in range(n):
			ans.append(num)
			num += diff
		if x in ans and y in ans:
			print(*ans)
			return
t = 1
t = int(input())
for _ in range(t):
	a()


def two_int(a, b):
	if a == b:
		return 0
	s = max(a, b) - min(a, b)
	t = s // 10
	rem = s % 10
	if rem:
		ans = t + 1
	else:
		ans = t
	return ans
t = int(input())
for _ in range(t):
	ab = input().split()
	a = int(ab[0])
	b = int(ab[1])
	print(two_int(a, b))


import sys

def Ints():
	return map(int, sys.stdin.readline().strip().split())

def Strs():
	return map(str, sys.stdin.readline().strip().split())

def Array():
	return list(map(int, sys.stdin.readline().strip().split()))

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

def Int():
	return int(sys.stdin.readline().strip())

def MOD():
	return 1000000007

def power(base, power):
	MOD = 1000000007
	result = 1
	while power > 0:
		if power % 2 == 1:
			result = result * base % MOD
		power = power // 2
		base = base * base % MOD
	return result
t = Int()
while t:
	t -= 1
	(a, b) = Ints()
	if a > b:
		(a, b) = (b, a)
	if a == b:
		print(0)
	else:
		count = 0
		c = b - a
		while c:
			for i in range(1, 11):
				if i > c:
					break
				value = i
			count += c // value
			c %= value
		print(count)


import sys
import math
inputlines = sys.stdin.readlines()
number_of_testcases = int(inputlines[0])
for i in range(number_of_testcases):
	(a, b) = list(map(int, inputlines[i + 1].split(' ')))
	difference = abs(a - b)
	answer = math.ceil(difference / 10)
	print(answer)


def solve():
	(a, b) = map(int, input().split())
	c = max(a, b)
	d = min(a, b)
	diff = c - d
	if diff % 10 == 0:
		print(diff // 10)
	else:
		print(diff // 10 + 1)
for i in range(int(input())):
	solve()


import os
import sys
import time
from io import BytesIO, IOBase

def localInput():
	sys.stdin = open('inputf.in', 'r')
	sys.stdout = open('outputf.in', 'w')
	sys.stderr = open('error.txt', 'w')

def print_to_stderr(*a):
	print(*a, file=sys.stderr)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]

def solve():
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		m = abs(a - b)
		if m % 10 == 0:
			print(m // 10)
		else:
			print(m // 10 + 1)

def main():
	test_cases = int(input())
	for test_units in range(test_cases):
		solve()
execution_time_start = time.clock()
main()
execution_time_stop = time.clock()
print_to_stderr('Total Time Taken: %f Seconds!' % (execution_time_stop - execution_time_start))


def process():
	(a, b) = map(int, input().split())
	if b > a:
		(a, b) = (b, a)
	(quot, mod) = ((a - b) // 10, (a - b) % 10)
	if mod == 0:
		return quot
	return quot + 1
for i in range(int(input())):
	print(process())


t = input()
t = int(t)
test_time = 0
while True:
	test_time = test_time + 1
	if test_time > t:
		break
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	i = 0
	if a == b:
		print(i)
	else:
		c = abs(b - a)
		if c > 10:
			i = c // 10
			if c % 10 > 0:
				i = i + 1
		else:
			i = i + 1
		print(i)


import math

def num(a, b):
	big = 0
	small = 0
	if a - b > 0:
		big += a
		small += b
	elif a - b < 0:
		big += b
		small += a
	else:
		big += a
		small += b
	rat = math.floor((big - small) / 10)
	if (big - small) % 10 == 0:
		print(rat)
	elif big == small:
		print(0)
	else:
		print(rat + 1)
m = int(input())
for lol in range(1, m + 1):
	(c, d) = input().split()
	num(int(c), int(d))


import sys
t = int(sys.stdin.readline().rstrip())
tests = []
for _ in range(t):
	(a, b) = [int(i) for i in sys.stdin.readline().rstrip().split()]
	tests.append((a, b))

def solve(a, b):
	if a == b:
		return 0
	delta = abs(a - b)
	is_b_larger = b >= a
	if is_b_larger and delta % 2 == 1:
		return 1
	if is_b_larger:
		return 2
	if delta % 2 == 1:
		return 2
	return 1
for test in tests:
	print(solve(test[0], test[1]))


def st(a, b):
	m = abs(a - b)
	if a > b:
		if m % 2 == 0:
			return 1
		else:
			return 2
	elif b > a:
		if m % 2 == 0:
			return 2
		else:
			return 1
	else:
		return 0
n = int(input())
for x in range(n):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	print(st(a, b))


try:
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		val = abs(a - b)
		if val == 0:
			print(0)
			continue
		if val <= 10:
			print(1)
			continue
		ans = 0
		ans += int(val / 10)
		if val % 10:
			ans += 1
		print(ans)
except:
	pass


import sys
input_file = sys.stdin
output_file = sys.stdout
t = int(input_file.readline())
for t in range(t):
	(a, b) = map(int, input_file.readline().split())
	if a == b:
		output_file.write('0')
	elif a & 1 != b & 1 and a < b or (a & 1 == b & 1 and a > b):
		output_file.write('1')
	else:
		output_file.write('2')
	output_file.write('\n')


def solve(a, b, ans):
	diff = abs(a - b)
	moves = 0
	for i in range(10, 0, -1):
		moves += diff // i
		diff %= i
	ans.append(str(moves))

def main():
	t = int(input())
	ans = []
	for i in range(t):
		(a, b) = map(int, input().split())
		solve(a, b, ans)
	print('\n'.join(ans))
main()


t = int(input())
for i in range(t):
	(a, b) = tuple(map(int, input().split()))
	print(int(abs(a - b) / 10) + int((a - b) % 10 != 0))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if b > a:
		(a, b) = (b, a)
	for i in range((a - b) // 10 - 1, a):
		if b + 10 * i >= a:
			break
	print(i)


t = int(input())
while t > 0:
	t -= 1
	(a, b) = map(int, input().split())
	if a == b:
		ans = 0
	else:
		l = abs(a - b)
		if l % 10 == 0:
			ans = l // 10
		else:
			ans = l // 10 + 1
	print(ans)


import sys
import math
t = int(sys.stdin.readline())
for i in range(t):
	[a, b] = [int(x) for x in sys.stdin.readline().split()]
	print(math.ceil(abs(a - b) / 10))


def solve(a, b):
	delta = b - a
	if delta == 0:
		return 0
	elif delta > 0:
		if delta % 2 == 1:
			return 1
		else:
			return 2
	elif delta % 2 == 0:
		return 1
	else:
		return 2

def main():
	t = int(input())
	for i in range(t):
		(a, b) = map(int, input().split())
		result = solve(a, b)
		print(result)
	return 0
main()


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


t = int(input())
for question in range(t):
	array = list(map(int, input().split()))
	d = abs(array[0] - array[1])
	if d % 10 == 0:
		print(d // 10)
	else:
		print(d // 10 + 1)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	diff = max(a, b) - min(a, b)
	res = diff // 10
	if diff % 10:
		print(res + 1)
	else:
		print(res)


import sys
t = int(input())
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	count = 0
	c = abs(b - a)
	d = int(c / 10)
	if c % 10 == 0:
		print(d)
	else:
		print(d + 1)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	ans = abs(a - b)
	an = 0
	for i in range(10, 0, -1):
		an += ans // i
		ans = ans % i
	print(an)


n = int(input())
output = []
for i in range(n):
	(a, b) = map(int, input().split())
	if a == b:
		output.append(0)
	elif b > a:
		diff = b - a
		if diff % 2 == 0:
			output.append(2)
		else:
			output.append(1)
	elif a > b:
		diff = a - b
		if diff % 2 == 0:
			output.append(1)
		else:
			output.append(2)
for i in output:
	print(int(i))


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


for i in range(int(input())):
	a = list(map(int, input().split()))
	if a[0] - a[1] == 0:
		print('0')
	elif a[0] > a[1]:
		if (a[0] - a[1]) % 2 == 0:
			print('1')
		elif (a[0] - a[1]) % 2 != 0:
			print('2')
	elif a[1] > a[0]:
		if (a[1] - a[0]) % 2 == 0:
			print('2')
		elif (a[1] - a[0]) % 2 != 0:
			print('1')


def minmoves(a, b):
	cnt = 0
	return (abs(a - b) + 9) // 10

def main():
	t = int(input())
	while t > 0:
		(a, b) = map(int, input().split())
		print(minmoves(a, b))
		t = t - 1
main()


n = int(input())
count = 0
l = []
while count < n:
	s = input()
	l.append(s.split(' '))
	count += 1
for x in l:
	move = 0
	diff = int(x[1]) - int(x[0])
	if diff < 0 and diff % 2 == 0 or (diff > 0 and diff % 2 != 0):
		move += 1
	elif diff == 0:
		move += 0
	else:
		move += 2
	print(move)


n = int(input())
while n != 0:
	n -= 1
	(a, b) = map(int, input().split())
	if a > b:
		t = a
		a = b
		b = t
	cnt = (b - a) // 10
	if (b - a) % 10 != 0:
		cnt += 1
	print(cnt)


n = int(input())
for i in range(n):
	lists = list(map(int, input(' ').split(' ')))
	a = lists[0]
	b = lists[1]
	cond = 1
	times = 0
	while cond:
		if a > b:
			value = a - b
			if value % 2 == 0:
				a = a - value
				times += 1
			else:
				a = value + a
				times += 1
		elif a < b:
			value = b - a
			if value % 2 == 0:
				a = value - 1 + a
				times += 1
			else:
				a = a + value
				times += 1
				cond = 1
		else:
			print(times)
			cond = 0


import math
import os
import random
import re
import sys
t = int(input())
for x in range(t):
	(a, b) = map(int, input().rstrip().split())
	c = abs(a - b) // 10
	if a == b:
		print('0')
	elif abs(a - b) % 10 == 0:
		print(c)
	else:
		print(c + 1)


t = int(input())
for trial in range(t):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	result_list = list()
	is_going = True
	while is_going:
		if b == a:
			is_going = False
		elif b > a:
			if (b - a) % 2 == 1:
				x = b - a
				a = a + x
				result_list.append(x)
				is_going = False
			else:
				y = 1
				a = a - y
				result_list.append(y)
		elif (a - b) % 2 == 0:
			y = a - b
			a = a - y
			result_list.append(y)
			is_going = False
		else:
			x = 1
			a = a + x
			result_list.append(x)
	print(len(result_list))


for _ in range(int(input())):
	arr1 = [int(i) for i in input().split()]
	if arr1[1] - arr1[0] == 0:
		print(0)
	elif abs(arr1[1] - arr1[0]) % 10 == 0:
		print(abs(arr1[1] - arr1[0]) // 10)
	else:
		print(abs(arr1[1] - arr1[0]) // 10 + 1)


import sys
input = sys.stdin.readline

def solve():
	(a, b) = [int(x) for x in input()[:-1].split()]
	d = abs(a - b)
	res = d // 10
	if d % 10 > 0:
		res += 1
	print(res)

def main():
	T = int(input())
	for _ in range(T):
		solve()
main()


b = int(input())
x = int(0)
while x < b:
	a = list(map(int, input().split()))
	if (a[0] - a[1]) % 2 == 0 and a[0] - a[1] > 0:
		print(1)
	elif (a[1] - a[0]) % 2 != 0 and a[1] - a[0] > 0:
		print(1)
	elif a[0] == a[1]:
		print(0)
	else:
		print(2)
	x = x + 1


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
for i in range(ii()):
	(a, b) = f()
	l = a - b
	if l > 0:
		if l % 2 == 0:
			print(1)
		elif l % 2 != 0:
			print(2)
	if l == 0:
		print(0)
	if l < 0:
		if abs(l) % 2 != 0:
			print(1)
		elif abs(l) % 2 == 0:
			print(2)


t = int(input())
while t > 0:
	(a, b) = [int(x) for x in input().split()]
	(a, b) = (min(a, b), max(a, b))
	d = b - a
	d1 = d // 10
	x = 0
	if not a % 10 == b % 10:
		x = 1
	print(d1 + x)
	t -= 1


def get_required_transform_operations(current_number, requested_result):
	if current_number == requested_result:
		return 0
	if requested_result > current_number:
		if (requested_result - current_number) % 2 == 1:
			return 1
		else:
			return 2
	elif (requested_result - current_number) % 2 == 0:
		return 1
	else:
		return 2
for _ in range(int(input())):
	data = tuple(map(int, input().split()))
	print(get_required_transform_operations(data[0], data[1]))


import sys
import os

def changeStdioToFile():
	path = os.path.dirname(os.path.abspath(__file__))
	sys.stdin = open(f'{path}/input.txt', 'r')
	sys.stdout = open(f'{path}/output.txt', 'w')
t = 1
t = int(input())
for _ in range(t):
	(a, b) = [int(x) for x in input().split()]
	if a == b:
		print(0)
	elif a > b:
		print(1 if a % 2 == b % 2 else 2)
	else:
		print(1 if a % 2 != b % 2 else 2)


from sys import stdin, stdout
input = stdin.buffer.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print((abs(a - b) + 9) // 10)


n = int(input())
while n:
	d = c = 0
	int_nos = input()
	ar = int_nos.split()
	d = abs(int(ar[0]) - int(ar[1]))
	c = int(d / 10)
	if d % 10 >= 1:
		c = c + 1
	print(c)
	n = n - 1


import math
import os
import random
import re
import string
from sys import *
from collections import *

def bs(arr, x, l, r):
	if l <= r:
		mid = (r + l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return bs(arr, x, l, mid - 1)
		else:
			return bs(arr, x, mid + 1, r)
	else:
		return -1

def solve():
	for _ in range(int(input())):
		(a, b) = map(int, stdin.readline().strip().split())
		d = abs(a - b)
		print(math.ceil(d / 10))
solve()


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


for _ in range(int(input())):
	(a, b) = map(int, input().strip().split())
	if a == b:
		print('0')
	elif a > b:
		z = a - b
		if z <= 10:
			print('1')
		else:
			s = z // 10
			d = z % 10
			if d == 0:
				print(s)
			else:
				print(s + 1)
	else:
		z = b - a
		if z <= 10:
			print('1')
		else:
			s = z // 10
			d = z % 10
			if d == 0:
				print(s)
			else:
				print(s + 1)


t = int(input())
while t != 0:
	(a, b) = list(map(int, input().split()))
	steps = int(abs(b - a) / 10)
	extra = int(abs(b - a) % 10)
	if extra > 0:
		steps += 1
	print(steps)
	t -= 1


t = int(input())
a = list()
b = list()
n = list()
k = 0
for i in range(t):
	q = input().split(' ')
	a.append(int(q[0]))
	b.append(int(q[1]))
for i in range(t):
	if a[i] > b[i]:
		if (a[i] - b[i]) % 2 == 0:
			n.append(1)
		else:
			n.append(2)
	elif a[i] < b[i]:
		if (b[i] - a[i]) % 2 != 0:
			n.append(1)
		else:
			n.append(2)
	else:
		n.append(0)
for i in range(t):
	print(n[i])


t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	nt = abs(b - a)
	if nt == 0:
		print('0')
	else:
		nt1 = nt // 10 + 1
		m = nt % 10
		if m == 0:
			print(nt1 - 1)
		else:
			print(nt1)


from collections import Counter
import math
import sys
from bisect import bisect, bisect_left, bisect_right

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

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def mod():
	return 10 ** 9 + 7
for i in range(INT()):
	(a, b) = MAP()
	ans = math.ceil(abs(a - b) / 10)
	print(ans)


n = int(input())
i = 0
while i < n:
	(a, b) = [int(i) for i in input().split()]
	kol = 0
	if a > b:
		(a, b) = (b, a)
	for j in range(10, 0, -1):
		if (b - a) // j > 0:
			kol += (b - a) // j
			a += (b - a) // j * j
		if a == b:
			break
	print(kol)
	i += 1


def oddeven(a, b):
	if a == b:
		res = 0
	elif a > b:
		if a % 2 == b % 2:
			res = 1
		else:
			res = 2
	elif a % 2 == b % 2:
		res = 2
	else:
		res = 1
	return res
q = int(input())
for i in range(q):
	(a, b) = map(int, input().split())
	result = oddeven(a, b)
	print(result)


def testcase(j):
	steps = 0
	c = 10
	while c > 0 and j != 0:
		steps += int(j / c)
		j = int(j % c)
		c -= 1
	return steps
a = int(input())
strs = []
for i in range(0, a):
	j = input().split(' ')
	if int(j[0]) < int(j[1]):
		strs.append(testcase(int(j[1]) - int(j[0])))
	elif int(j[0]) > int(j[1]):
		strs.append(testcase(int(j[0]) - int(j[1])))
	else:
		strs.append(0)
for i in range(0, a):
	print(strs[i])


mod = 10 ** 9 + 7

def readInt():
	return int(input())

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

def readStringList():
	return list(input())

def readStringListWithSpace():
	return list(input().split())

def readString():
	return input()
t = readInt()
for _ in range(t):
	(a, b) = readIntList()
	diff = abs(a - b)
	(div, rem) = divmod(diff, 10)
	res = div if not rem else div + 1
	print(res)


e = int(input())
p = []
for ee in range(e):
	(a, b) = map(int, input().split())
	if a == b:
		p.append(0)
		continue
	elif a < b:
		if a % 2 == 0 and b % 2 == 0:
			p.append(2)
			continue
		elif a % 2 == 0 and b % 2 == 1:
			p.append(1)
			continue
		elif a % 2 == 1 and b % 2 == 1:
			p.append(2)
			continue
		else:
			p.append(1)
			continue
	elif a % 2 == 0 and b % 2 == 0:
		p.append(1)
		continue
	elif a % 2 == 0 and b % 2 == 1:
		p.append(2)
		continue
	elif a % 2 == 1 and b % 2 == 1:
		p.append(1)
		continue
	else:
		p.append(2)
		continue
for i in range(len(p)):
	print(p[i])


def read_ints():
	return map(int, input().split())
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	count = 0
	(whole, rem) = divmod(abs(a - b), 10)
	count += whole
	if rem:
		count += 1
	print(count)


t = int(input())
for i in range(0, t):
	str2 = input()
	l1 = str2.split(' ')
	a = int(l1[0])
	c = int(l1[1])
	d = c - a
	if d > 0:
		if d % 2 == 0:
			print(2)
		else:
			print(1)
	elif d < 0:
		if d % 2 == 0:
			print(1)
		else:
			print(2)
	else:
		print(0)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		res = 0
		sub = abs(b - a)
		if sub % 10:
			res = sub // 10 + 1
		else:
			res = sub // 10
		print(res)


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


testCases = input()
for x in range(0, int(testCases)):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	count = 0
	while a != b:
		count = count + 1
		if a < b:
			if (b - a) % 2 == 0:
				a = a + (b - a - 1)
			else:
				a = a + b - a
		elif (a - b) % 2 == 0:
			a = a - (a - b)
		else:
			a = a - (a - b + 1)
	print(count)


def getIn():
	return input().strip()
t = int(getIn())
for _ in range(t):
	(a, b) = getIn().split(' ')
	(a, b) = (int(a), int(b))
	if b > a:
		diff = b - a
		if diff % 2 != 0:
			print(1)
		else:
			print(2)
	elif a > b:
		diff = a - b
		if diff % 2 == 0:
			print(1)
		else:
			print(2)
	else:
		print(0)


n = int(input())

def g(n):
	for _ in range(n):
		x = input()
		y = x.split(' ')
		a = int(y[0])
		b = int(y[1])
		if abs(a - b) // 10 == abs(a - b) / 10:
			print(abs(a - b) // 10)
		else:
			print(abs(a - b) // 10 + 1)
g(n)


import os
import sys
from io import BytesIO, IOBase

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())

def main():
	t = int(input())
	for _ in range(t):
		(a, b) = mi()
		d = abs(a - b)
		if d % 10 != 0:
			res = d // 10 + 1
		else:
			res = d // 10
		print(res)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from math import ceil as c
x = int(input())
for i in range(x):
	(a, b) = map(int, input().split())
	print(c((max(a, b) - min(a, b)) / 10))


t = int(input())
for i in range(0, t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)

	def add_sub(a, b):
		if a < b:
			c = b - a
			if c % 2 == 0:
				return 2
			else:
				return 1
		elif a > b:
			d = a - b
			if d % 2 == 0:
				return 1
			else:
				return 2
		else:
			return 0
	print(add_sub(a, b))


t = int(input())
arr = []
for j in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		arr.append(0)
	elif b - a > 0 and (b - a) % 2 == 0:
		arr.append(2)
	elif b - a > 0 and (b - a) % 2 != 0:
		arr.append(1)
	elif b - a < 0 and (b - a) % 2 == 0:
		arr.append(1)
	elif b - a < 0 and (b - a) % 2 != 0:
		arr.append(2)
for i in arr:
	print(i)


for _ in range(int(input())):
	lis = list(map(int, input().split()))
	(a, b) = (lis[0], lis[1])
	(a, b) = (min(a, b), max(a, b))
	r = b - a
	s = r // 10
	print(s + (1 if r % 10 != 0 else 0))


def check(a, b):
	if a == b:
		return 0
	x = abs(a - b)
	if x <= 10:
		return 1
	r = x % 10
	x = x // 10
	if r == 0:
		return x
	return x + 1
for _ in range(int(input())):
	(a, b) = map(int, input().split(' '))
	print(check(a, b))


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


def p0(a, b):
	count = 0
	k = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
	if a == b:
		return count
	if abs(b - a) in k:
		count += 1
		return count
	temp = b
	if abs(b - a) > 10:
		div = abs(b - a) // 10
		count = div
		if abs(b - a) % 10 == 0:
			return count
		else:
			return count + 1
t = int(input())
while t:
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	ans = p0(a, b)
	print(ans)
	t = t - 1


t = int(input())
for i in range(t):
	arr = input().split()
	a = int(arr[0])
	b = int(arr[1])
	if a > b:
		dif = a - b
		if dif % 2 == 0:
			print(1)
		else:
			print(2)
	elif a == b:
		print(0)
	else:
		no = b - a
		if no % 2 != 0:
			print(1)
		else:
			print(2)


for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	count = 0
	if a == b:
		print(0)
	else:
		if a > b:
			(a, b) = (b, a)
		razn = b - a
		count += razn // 10
		razn %= 10
		if razn != 0:
			count += 1
		print(count)


import math
for a0 in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	ans = math.ceil(abs(b - a) / 10)
	print(ans)


t = int(input())
for i in range(0, t):
	ab = input().split()
	a = int(ab[0])
	b = int(ab[1])
	mod = abs(b - a) % 10
	mov = int((abs(b - a) - mod) / 10)
	print(mov + (0 if mod == 0 else 1))


def solve():
	(a, b) = [int(i) for i in input().split()]
	return abs(a - b) // 10 + (1 if abs(a - b) % 10 != 0 else 0)
t = int(input())
ans = []
while t:
	ans.append(str(solve()))
	t -= 1
print('\n'.join(ans))


l = []
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = n - m
	if a > 0:
		a = 1 if a % 2 == 0 else 2
	elif a < 0:
		a = 1 if a % 2 != 0 else 2
	l.append(a)
[print(i) for i in l]


t = int(input())
if t in range(1, 10001):
	for i in range(t):
		s = input().split()
		a = int(s[0])
		b = int(s[1])
		if a in range(1, 10 ** 9 + 1) and b in range(1, 10 ** 9 + 1):
			if a == b:
				print('0')
			diff = abs(a - b)
			if a < b:
				if diff % 2 == 0:
					print('2')
				else:
					print('1')
			if a > b:
				if diff % 2 == 0:
					print('1')
				else:
					print('2')
		else:
			pass


import math
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n > k:
		print(abs(math.ceil((n - k) / 10)))
	else:
		print(abs(math.ceil((k - n) / 10)))


t = int(input())
ccc = []
while t > 0:
	ttt = [int(item) for item in input().split()]
	(a, b) = (ttt[0], ttt[1])
	ccc.append((abs(a - b) + 9) // 10)
	t -= 1
ccc = [str(item) for item in ccc]
print('\n'.join(ccc))


t = int(input())
while t:
	t -= 1
	ab = [int(i) for i in input().split()]
	(a, b, d) = (ab[0], ab[1], abs(ab[0] - ab[1]))
	if d == 0:
		print(0)
	elif a < b:
		print(1 if d % 2 == 1 else 2)
	else:
		print(1 if d % 2 == 0 else 2)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split(' '))
	k = 0
	if a == b:
		print(k)
		continue
	k += abs(a - b) // 10
	if a + k * 10 == b or a - k * 10 == b:
		print(k)
		continue
	else:
		print(k + 1)


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]
for _ in range(II()):
	(a, b) = MI()
	print((abs(a - b) + 9) // 10)


t = int(input())
for i in range(0, t):
	(a, b) = map(int, input().split())
	num = 0
	if a == b:
		pass
	elif a < b:
		diff = b - a
		num += diff // 10
		if diff % 10 != 0:
			num += 1
	else:
		diff = a - b
		num += diff // 10
		if diff % 10 != 0:
			num += 1
	print(num)


def solve():
	l = list(map(int, input().split()))
	a = min(l)
	b = max(l)
	otv = (b - a - (b - a) % 10) // 10
	if (b - a) % 10 != 0:
		otv += 1
	print(otv)
n = int(input())
for _ in range(n):
	solve()


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


t = int(input())
output = []
for i in range(t):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	if b > a:
		count = 0
		d = b - a
		count = d // 10
		a = a + 10 * count
		if a == b:
			output.append(count)
		else:
			output.append(count + 1)
	elif b < a:
		count = 0
		d = a - b
		count = d // 10
		a = a - 10 * count
		if a == b:
			output.append(count)
		else:
			output.append(count + 1)
	else:
		output.append(0)
for item in output:
	print(item)


move = 0
arr = []
t = int(input())
for t in range(0, t):
	(a, b) = map(int, input().split())
	arr.append(a)
	arr.append(b)
for i in range(0, t + 1):
	a = arr[2 * i]
	b = arr[2 * i + 1]
	if a == b:
		print(0)
	elif a < b:
		if (b - a) % 2 == 0:
			move = 2
			print(move)
		else:
			move = 1
			print(move)
	elif a > b:
		if (a - b) % 2 == 0:
			move = 1
			print(move)
		else:
			move = 2
			print(move)


def f(x, y):
	if x == y:
		return 0
	if x > y:
		if (x - y) % 2 == 0:
			return 1
		else:
			return 2
	elif (y - x) % 2 == 1:
		return 1
	else:
		return 2
t = int(input())
for i in range(0, t):
	(n, k) = map(int, input().split())
	print(f(n, k))


n = int(input())
for _ in range(n):
	y = list(map(int, input().split()))
	a = y[0]
	b = y[1]
	c = abs(a - b)
	r = 0
	while c > 10:
		r += int(c / 10)
		c = c % 10
	if c > 0:
		r = r + 1
	print(r)


start_num = 0
try_num = int(input())
while start_num < try_num:
	start_num += 1
	(a, b) = map(int, input().split())
	if a > b:
		z = a - b
		if z % 2 == 0:
			print('1')
		else:
			print('2')
	if b > a:
		z = b - a
		if z % 2 != 0:
			print('1')
		else:
			print('2')
	if a == b:
		print('0')


t = int(input())
listNEW = []
for i in range(0, t):
	list1 = [int(i) for i in input().split()]
	a = list1[0]
	b = list1[1]
	if a > b:
		c = (a - b) // 10
		d = (a - b) % 10
		if d == 0:
			listNEW.append(c)
		else:
			listNEW.append(c + 1)
	if a == b:
		listNEW.append(0)
	if a < b:
		c = (b - a) // 10
		d = (b - a) % 10
		if d == 0:
			listNEW.append(c)
		else:
			listNEW.append(c + 1)
for i in listNEW:
	print(i)


import math
t = int(input())
output = []
for i in range(t):
	(a, b) = [int(i) for i in input().split()]
	output.append(math.ceil(abs(a - b) / 10))
for i in range(t):
	print(output[i])


def cal():
	li = list(input().split())
	a = int(li[1]) - int(li[0])
	if a % 2 == 0 and a < 0:
		return 1
	if a % 2 != 0 and a > 0:
		return 1
	if a == 0:
		return 0
	return 2
for i in range(int(input())):
	print(cal())


j = input()
for i in range(0, int(j)):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	nb = 0
	dif = abs(a - b)
	nb += dif // 10
	nb += 1 if dif % 10 != 0 else 0
	print(nb)


for _ in range(int(input())):
	(n, ans) = map(int, input().split())
	count = 0
	if n == ans:
		print('0')
	else:
		if n > ans:
			numb = n - ans
		else:
			numb = ans - n
		while numb > 0:
			if numb <= 10:
				count += 1
				numb = 0
			else:
				count += numb // 10
				numb = numb % 10
		print(count)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	k10 = d // 10
	klt = int(d % 10 != 0)
	print(k10 + klt)


import math
import sys
readline = sys.stdin.readline
test_range = readline()
for i in range(int(test_range)):
	(x, y) = readline().split(' ')
	print(math.ceil(abs(int(x) - int(y)) / 10))


t = int(input())
for q in range(t):
	(a, b) = map(int, input().split())
	dif = abs(a - b)
	res = dif / 10
	first = int(res)
	new = str(dif)
	if new[-1] == '0':
		print(first)
	else:
		print(first + 1)


from pathlib import Path
import sys
import functools
import itertools
import re

def solve():
	t = int(input())
	for test in range(0, t):
		(a, b) = map(int, input().split())
		if a == b:
			print(0)
		elif abs(a - b) <= 10:
			print(1)
		else:
			x = abs(a - b) // 10
			y = abs(a - b) % 10
			if y >= 1:
				x += 1
			print(x)

def main():
	if Path('test.inp').exists():
		sys.stdin = open('test.inp', 'r')
	solve()
main()


t = int(input())
while t != 0:
	(a, b) = map(int, input().split())
	diff = b - a
	if diff == 0:
		print(0)
	elif diff > 0 and diff % 2 == 1 or (diff < 0 and abs(diff) % 2 == 0):
		print(1)
	else:
		print(2)
	t -= 1


t = int(input())
for i in range(0, t):
	a = input().split()
	a[0] = int(a[0])
	a[1] = int(a[1])
	b = a[1]
	a = a[0]
	c = abs(a - b)
	moves = 0
	for j in reversed(range(1, 11)):
		if c > 0 and c >= j:
			moves += int(c / j)
			c = c % j
	print(moves)


v = int(input())
for i in range(v):
	a = [int(x) for x in input().split()]
	if a[0] == a[1]:
		print(0)
	elif a[0] > a[1]:
		c = str(a[0] - a[1])
		if len(c) > 1:
			if c[-1] != '0':
				d = c[:-1]
				d = int(d) + 1
			else:
				d = c[:-1]
				d = int(d)
			print(d)
		else:
			print(1)
	elif a[1] > a[0]:
		c = str(a[1] - a[0])
		if len(c) > 1:
			if c[-1] != '0':
				d = c[:-1]
				d = int(d) + 1
			else:
				d = c[:-1]
				d = int(d)
			print(d)
		else:
			print(1)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	c = a % 2
	d = b % 2
	if a < b:
		if c == 0 and d == 0:
			print(2)
		if c == 1 and d == 1:
			print(2)
		if c == 0 and d == 1:
			print(1)
		if c == 1 and d == 0:
			print(1)
	if a > b:
		if c == 0 and d == 0:
			print(1)
		if c == 1 and d == 1:
			print(1)
		if c == 0 and d == 1:
			print(2)
		if c == 1 and d == 0:
			print(2)
	if a == b:
		print(0)


def transform(x, y):
	if x == y:
		return 0
	counter = 0
	while x != y:
		if x < y and (y - x) % 2 != 0:
			counter += 1
			x += y - x
		elif x > y and (x - y) % 2 != 0:
			counter += 1
			x -= x - y + 1
		elif x > y and (x - y) % 2 == 0:
			counter += 1
			x -= x - y
		elif x < y and (y - x) % 2 == 0:
			counter += 1
			x += y - x - 1
		else:
			return None
	return counter
n = int(input())
for i in range(0, n):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	print(transform(a, b))


j = int(input())
for i in range(j):
	c = input().split()
	a = int(c[0])
	b = int(c[1])
	diff = abs(a - b)
	sumi = 0
	if a == b:
		sumi = 0
	else:
		p = 10
		while diff != 0 and p > 0:
			sumi = sumi + diff // p
			diff = diff % p
			p = p - 1
	print(sumi)


import sys

def I():
	return int(sys.stdin.readline().rstrip())

def MI():
	return map(int, sys.stdin.readline().rstrip().split())
t = I()
for i in range(t):
	(a, b) = MI()
	print((abs(a - b) + 9) // 10)


def calc_prblm(a, b):
	n = abs(a - b)
	s = n // 10
	if n % 10 != 0:
		s = s + 1
	return s

def main():
	a = int(input())
	for i in range(a):
		(a, b) = map(int, input().split())
		n = calc_prblm(a, b)
		print(n)

def main_prblm():
	n = 1
	if n >= 1:
		main()
main_prblm()


from math import ceil
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print('0')
		continue
	else:
		diff = abs(a - b)
		ans = ceil(diff / 10)
		print(ans)


import sys

def main():
	input = sys.stdin.readline
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		if a == b:
			print(0)
		elif a > b and a & 1 == b & 1:
			print(1)
		elif a < b and a & 1 == b & 1:
			print(2)
		elif a > b:
			print(2)
		elif a < b:
			print(1)
main()


cases = int(input())
for case in range(cases):
	(a, b) = tuple(map(int, input().split()))
	ans = abs(a - b) // 10
	if abs(a - b) % 10 != 0:
		ans += 1
	print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		val = 0
		temp = max(a, b) - min(a, b)
		if temp % 10 == 0:
			val = temp // 10
		else:
			val = temp // 10 + 1
		print(val)


from math import ceil
for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	(a, b) = (min(a, b), max(a, b))
	z = b - a
	if z == 0:
		print(0)
	else:
		print(ceil(z / 10))


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


T = int(input())
import math
for t in range(T):
	(a, b) = list(map(int, input().split()))
	k = math.ceil(abs(b - a) / 10)
	print(k)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	n = abs(b - a)
	note = 0
	while n != 0:
		if n // 10 > 0:
			note += n // 10
			n -= n // 10 * 10
		elif n // 9 > 0:
			note += n // 9
			n -= n // 9 * 9
		elif n // 8 > 0:
			note += n // 8
			n -= n // 8 * 8
		elif n // 7 > 0:
			note += n // 7
			n -= n // 7 * 7
		elif n // 6 > 0:
			note += n // 6
			n -= n // 6 * 6
		elif n // 5 > 0:
			note += n // 5
			n -= n // 5 * 5
		elif n // 4 > 0:
			note += n // 4
			n -= n // 4 * 4
		elif n // 3 > 0:
			note += n // 3
			n -= n // 3 * 3
		elif n // 2 > 0:
			note += n // 2
			n -= n // 2 * 2
		elif n // 1 > 0:
			note += n // 1
			n -= n // 1 * 1
	print(note)


t = int(input())
res = []
for i in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		res.append(0)
	elif a > b and (a - b) % 2 == 0 or (a < b and (b - a) % 2 != 0):
		res.append(1)
	else:
		res.append(2)
for i in range(t):
	print(res[i])


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	(a, b) = list(map(int, stdin.readline().split()))
	diff = abs(a - b)
	m1 = diff // 10
	rem = diff % 10
	print(m1 + (1 if rem != 0 else 0))


def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1
n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	print(ceil(c, 10))


import math
k = int(input())
for _ in range(k):
	[a, b] = [int(x) for x in input().split(' ')]
	print(math.ceil(abs(b - a) / 10))


n = int(input())
for i in range(n):
	arr = input().split(' ')
	a = int(arr[0])
	b = int(arr[1])
	if a == b:
		print(0)
	elif a > b and (a - b) % 2 == 0:
		print(1)
	elif a > b and (a - b) % 2 != 0:
		print(2)
	elif a <= b and (b - a) % 2 == 0:
		print(2)
	elif a <= b and (b - a) % 2 != 0:
		print(1)


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		(a, b) = In()
		dif = abs(a - b)
		ans = 0
		for i in range(10, 0, -1):
			if dif >= i:
				temp = dif // i
				ans += temp
				dif -= temp * i
		print(ans)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


import math
import collections
t = int(input())
for _ in range(0, t):
	(n, m) = map(int, input().split())
	if n != m:
		z = abs(n - m)
		z = z / 10
		z = str(z)
		for i in range(0, len(z)):
			if z[i] == '.':
				break
		if z[i + 1] != '0':
			z = float(z)
			z = int(z) + 1
		else:
			z = float(z)
			z = int(z)
	else:
		z = 0
	print(z)


t = int(input())
res = []
for i in range(t):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	c1 = int(c / 10)
	c2 = c % 10
	if c2 == 0:
		res.append(c1)
	else:
		res.append(c1 + 1)
for i in res:
	print(i)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	k = abs(a - b)
	te = k // 10
	if te * 10 == k:
		print(te)
	else:
		print(te + 1)


import sys
import string
import math
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache
from fractions import Fraction

def mi(s):
	return map(int, s.strip().split())

def lmi(s):
	return list(mi(s))

def tmi(s):
	return tuple(mi(s))

def mf(f, s):
	return map(f, s)

def lmf(f, s):
	return list(mf(f, s))

def js(lst):
	return ' '.join((str(d) for d in lst))

def jsns(lst):
	return ''.join((str(d) for d in lst))

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

def linesp():
	return line().split()

def iline():
	return int(line())

def mat(n):
	matr = []
	for _ in range(n):
		matr.append(linesp())
	return matr

def matns(n):
	mat = []
	for _ in range(n):
		mat.append([c for c in line()])
	return mat

def mati(n):
	mat = []
	for _ in range(n):
		mat.append(lmi(line()))
	return mat

def pmat(mat):
	for row in mat:
		print(js(row))

def solve():
	(a, b) = mi(line())
	if b >= a:
		moves = math.ceil((b - a) / 10)
	else:
		moves = math.ceil((a - b) / 10)
	print(moves)

def main():
	t = iline()
	for _ in range(t):
		solve()
main()


import math
for i in range(int(input())):
	(x, y) = map(int, input().split(' '))
	diff = abs(x - y)
	end = math.ceil(diff / 10)
	print(end)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	m = 0
	if a > b:
		x = abs(a - b)
		if x % 2 != 0:
			m += 2
		else:
			m += 1
	elif a < b:
		x = abs(a - b)
		if x % 2 == 0:
			m += 2
		else:
			m += 1
	print(m)


t = int(input())
for i in range(t):
	(a, b) = [int(x) for x in input().split()]
	r = abs(a - b)
	if r % 10 == 0:
		print(r // 10)
	else:
		print(r // 10 + 1)


import sys
input = sys.stdin.readline
t = int(input())
for t1 in range(t):
	(a, b) = list(map(int, input().split(' ')))
	diff = abs(a - b)
	a = 0
	if diff % 10 != 0:
		a = 1
	ans = diff // 10 + a
	print(ans)


n = int(input())
while n != 0:
	(b, a) = map(int, input().split())
	ans = abs(a - b)
	twoans = ans // 10
	if ans % 10 != 0:
		twoans = twoans + 1
	print(twoans)
	n -= 1


T = int(input().strip())
debug = False
for t in range(T):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a > b:
		if (a - b) % 2 == 0:
			print(1)
		else:
			print(2)
	elif (b - a) % 2 == 0:
		if (b - a) // 2 % 2 == 0:
			print(2)
		else:
			print(2)
	else:
		print(1)


def add1(a, b):
	return (abs(a - b) + 10 - 1) / 10
n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	print(int(add1(a, b)))


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


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = 0
	h = -1
	while a != b:
		if a > b:
			d = a - b
			if d % 2 == 0:
				print('1')
				h = 1
				break
			else:
				print('2')
				h = 1
				break
		else:
			d = b - a
			if d % 2 != 0:
				print('1')
				h = 1
				break
			else:
				print('2')
				h = 1
				break
	if h == -1:
		print('0')


R = lambda : map(int, i.split())
for i in [*open(0)][1:]:
	(a, b) = R()
	print(-abs(a - b) // 10 * -1)


for i in range(int(input())):
	(n, m) = map(int, input().split())
	if n == m:
		print(0)
	elif abs(m - n) % 2 == 0 and n < m or (abs(n - m) % 2 == 1 and n > m):
		print(2)
	else:
		print(1)


t = int(input())
tasks = []
for i in range(t):
	tasks.append(list(map(int, input().split())))
for i in range(t):
	a = tasks[i][0]
	b = tasks[i][1]
	(a, b) = (max(a, b), min(a, b))
	if a == b:
		print(0)
	else:
		print((a - b - 1) // 10 + 1)


for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	print((abs(a - b) - 1) // 10 + 1)


from sys import stdin, stdout
from collections import Counter, OrderedDict
import math
cin = stdin.readline
cout = stdout.write
mp = lambda : list(map(int, cin().split()))

def chars():
	s = cin()
	return list(s[:len(s) - 1])

def pl(a):
	for val in a:
		cout(str(val))
	cout('\n')
(t,) = mp()
for _ in range(t):
	(a, b) = mp()
	x = abs(a - b)
	pl([math.ceil(x / 10)])


import sys, time
import math
start_time = time.time()

def solved():
	(a, b) = in_int_map()
	diff = abs(a - b)
	print(math.ceil(diff / 10))
ONLINE_JUDGE = True

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = in_int()
	for tt in range(1, t + 1):
		solved()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
		sys.stdout.close()

def in_int():
	return int(input().strip())

def in_float():
	return float(input().strip())

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

def in_int_map():
	return map(int, input().split())

def in_float_list():
	return list(map(float, input().split()))

def in_float_map():
	return map(float, input().split())

def in_str():
	return input().strip()

def in_str_list():
	return input().split()
if ONLINE_JUDGE:
	import io, os
	input = sys.stdin.readline
main()


def get_min_moves(a, b):
	diff = abs(b - a)
	if diff == 0:
		return 0
	return -(-diff // 10)
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	print(get_min_moves(a, b))


from sys import stdin, stdout
t = int(stdin.readline())
for case in range(t):
	(a, b) = map(int, stdin.readline().split())
	moves = 0
	if a == b:
		moves == 0
	elif a < b:
		if a % 2 != b % 2:
			moves = 1
		else:
			moves = 2
	elif a % 2 != b % 2:
		moves = 2
	else:
		moves = 1
	stdout.write('{}\n'.format(moves))


def ans(a, b):
	return abs(a - b) // 10 + (1 if abs(a - b) % 10 != 0 else 0)
t = int(input())
while t > 0:
	(a, b) = list(map(int, input().split(' ')))
	out = ans(a, b)
	print(out)
	t -= 1


def problem(a, b):
	ans = 0
	if a == b:
		return ans
	max_ = max(a, b)
	min_ = min(a, b)
	temp = max_ - min_
	ans = temp // 10
	if temp % 10 != 0:
		ans += 1
	return ans
testcases = int(input())
for i in range(testcases):
	(a, b) = list(map(int, input().split()))
	res = problem(a, b)
	print(res)


n = int(input())
for i in range(0, n):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	if a > b:
		a = a - b
	else:
		a = b - a
	c = a // 10
	if a % 10 == 0:
		print(c)
	else:
		print(c + 1)


import math
t = int(input())
while t > 0:
	t = t - 1
	(n, m) = map(int, input().split())
	ab = abs(n - m)
	if ab % 10 == 0:
		print(ab // 10)
	else:
		print(ab // 10 + 1)


T = int(input())
L = []
for i in range(T):
	L.append([int(x) for x in input().split()])
for i in L:
	print(1 if i[0] < i[1] and (i[0] - i[1]) % 2 == 1 or (i[0] > i[1] and (i[0] - i[1]) % 2 == 0) else 2 if i[0] > i[1] and (i[0] - i[1]) % 2 == 1 or (i[0] < i[1] and (i[0] - i[1]) % 2 == 0) else 0)


t = int(input())
for i in range(t):
	k = 0
	d = 0
	(a, b) = map(int, input().split())
	if a == b:
		print('0')
		continue
	if a > b:
		d = (a - b + 9) / 10
		print(int(d))
	if a < b:
		d = (b - a + 9) / 10
		print(int(d))


tc = int(input())
while tc > 0:
	(a, b) = map(int, input().split())
	res = abs(b - a)
	div = res // 10
	if res % 10 != 0:
		div += 1
	print(div)
	tc -= 1


n = int(input())
anss = []
per = 0
count = 0
for i in range(n):
	ab = input().split()
	a = int(ab[0])
	b = int(ab[1])
	if a > b:
		per = a - b
	else:
		per = b - a
	count += per // 10
	if per % 10 != 0:
		count += 1
	anss.append(count)
	count = 0
for i in anss:
	print(i)


import sys
t = int(sys.stdin.readline())
for test in range(t):
	(a, b) = map(int, sys.stdin.readline().split())
	d = abs(a - b) + 9
	ans = d // 10
	print(ans)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	k = abs(a - b)
	r = k // 10
	r1 = k % 10
	if r1 == 0:
		print(r)
	else:
		print(r + 1)


from math import ceil
for _ in range(int(input())):
	(awal, tujuan) = map(int, input().split())
	if tujuan == awal:
		print(0)
	elif tujuan > awal:
		print(ceil((tujuan - awal) / 10))
	elif tujuan < awal:
		print(ceil((awal - tujuan) / 10))


import math
t = int(input())
out = []
for i in range(t):
	ab = input().split(' ')
	a = int(ab[0])
	b = int(ab[1])
	ans = math.ceil(abs(a - b) / 10)
	out.append(ans)
for i in out:
	print(i)


for i in range(int(input())):
	(a, b) = sorted(map(int, input().split()))
	dif = b - a
	(difm, difd) = (dif % 20, dif // 20)
	print(dif // 20 * 2 + bool(difm) + bool(difm % 20 > 10))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		temp = b
		b = a
		a = temp
	if a == b:
		print('0')
	else:
		k = a - b
		ans = k // 10
		p = k % 10
		if p != 0:
			ans += 1
		print(ans)


from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	T = int(input())
	for _ in [0] * T:
		(A, B) = map(int, input().split())
		if A < B:
			if (B - A) % 2:
				ans = 1
			else:
				ans = 2
		elif A > B:
			if (A - B) % 2:
				ans = 2
			else:
				ans = 1
		else:
			ans = 0
		print(ans)
main()


q = int(input())
a = []
b = []
res = []
for i in range(q):
	(A, B) = (int(j) for j in input().split())
	a.append(A)
	b.append(B)
for i in range(q):
	x = a[i]
	y = b[i]
	result = 0
	if y == x:
		result = 0
	elif x < y:
		z = y - x
		result = z // 10
		if z % 10 != 0:
			result += 1
	elif y < x:
		z = x - y
		result = z // 10
		if z % 10 != 0:
			result += 1
	res.append(result)
for pororo in range(q):
	print(res[pororo])


t = int(input())
for p in range(t):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	k = c // 10
	if c % 10 != 0:
		k += 1
	print(k)


n = int(input())
ab = [tuple(map(int, input().split())) for i in range(n)]
ans = []
for (a, b) in ab:
	if a == b:
		ans.append(0)
	elif a < b and (b - a) % 2 == 1 or (b < a and (a - b) % 2 == 0):
		ans.append(1)
	else:
		ans.append(2)
print(*ans, sep='\n')


t = int(input())
answer = []
for a in range(t):
	line = input().split()
	a = int(line[0])
	b = int(line[1])
	if b > a:
		if (b - a) % 2 == 1:
			answer.append(1)
		else:
			answer.append(2)
	elif b == a:
		answer.append(0)
	elif (a - b) % 2 == 0:
		answer.append(1)
	else:
		answer.append(2)
for b in answer:
	print(str(b))


import math
t = int(input())
for tc in range(t):
	(a, b) = map(int, input().split())
	x = abs(a - b) % 10
	if x == 0:
		if a != b:
			print(int(abs(a - b) / 10))
		else:
			print(0)
	else:
		print(int(math.ceil(abs(a - b) / 10)))


for _ in range(int(input())):
	(a, b) = sorted(map(int, input().split()))
	k = b - a
	print(k // 10 + (k % 10 > 0))


t = int(input())
while t:
	(a, b) = map(int, input().split())
	x = abs(a - b)
	y = x // 10
	z = x - y * 10
	if z > 0:
		print(y + 1)
	else:
		print(y)
	t -= 1


def odd(a):
	return a % 2 == 1

def even(a):
	return a % 2 == 0
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	if odd(a) and odd(b):
		if b > a:
			print(2)
			continue
		else:
			print(1)
			continue
	if even(a) and even(b):
		if b < a:
			print(1)
			continue
		else:
			print(2)
			continue
	if even(a) and odd(b):
		if b > a:
			print(1)
			continue
		else:
			print(2)
			continue
	if even(b) and odd(a):
		if b > a:
			print(1)
			continue
		else:
			print(2)
			continue


for i in range(int(input())):
	(a, b) = map(int, input().split(' '))
	m = max([a, b])
	n = min([a, b])
	ans = 0
	m -= n
	while m > 0:
		if m >= 10:
			ans += m // 10
			m = m % 10
		else:
			m -= m
			ans += 1
	print(ans)


for i in range(int(input())):
	(a, b) = [int(num) for num in input().split()]
	if a == b:
		print(0)
		continue
	d = abs(b - a)
	if d % 10 == 0:
		print(d // 10)
	else:
		print(d // 10 + 1)


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


def main():
	from sys import stdin, stdout
	for _ in range(int(stdin.readline())):
		(a, b) = map(int, stdin.readline().split())
		if b == a:
			stdout.write('0\n')
		elif b > a:
			if b & 1:
				if a & 1:
					stdout.write('2\n')
				else:
					stdout.write('1\n')
			elif a & 1:
				stdout.write('1\n')
			else:
				stdout.write('2\n')
		elif b & 1:
			if a & 1:
				stdout.write('1\n')
			else:
				stdout.write('2\n')
		elif a & 1:
			stdout.write('2\n')
		else:
			stdout.write('1\n')
main()


n = int(input())
count = 0
for i in range(n):
	z = input().split(' ')
	a = int(z[0])
	b = int(z[1])
	if abs(b - a) % 10 == 0:
		count = abs(b - a) // 10
		print(count)
	else:
		count = abs(b - a) // 10 + 1
		print(count)


x = int(input())
i = 0
v = 0
f = 0
for i in range(x):
	(a, b) = map(int, input().split())
	if a < b:
		if (b - a) % 2 == 0:
			print('2')
		else:
			print('1')
	elif a > b:
		if (b - a) % 2 != 0:
			print('2')
		else:
			print('1')
	else:
		print('0')


myList = []
for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	if a == b:
		myList.append(0)
	elif abs(a - b) <= 10:
		myList.append(1)
	else:
		q = abs(a - b) // 10
		if (a - b) % 10 != 0:
			myList.append(q + 1)
		else:
			myList.append(q)
for elem in myList:
	print(elem)


import time, math as mt, bisect as bs, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

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

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * (2 * 10 ** 5 + 5)
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(2 * 10 ** 5 + 5):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return

def readTree(n, e):
	adj = [set() for i in range(n + 1)]
	for i in range(e):
		(u1, u2) = IP()
		adj[u1].add(u2)
	return adj
mod = 10 ** 9 + 7

def solve():
	(a, b) = IP()
	diff = max(a, b) - min(a, b)
	ans = diff // 10
	if diff % 10:
		ans += 1
	P(ans)
	return
t = II()
for i in range(t):
	solve()


for q in range(int(input())):
	x = list(map(int, input().split()))
	if x[0] == x[1]:
		print(0)
	elif x[1] - x[0] > 0:
		if (x[1] - x[0]) % 2 == 1:
			print(1)
		else:
			print(2)
	elif (x[0] - x[1]) % 2 == 1:
		print(2)
	else:
		print(1)


n = int(input())
resultados = []
for i in range(n):
	ab = input().split()
	a = int(ab[0])
	b = int(ab[1])
	if b - a > 0:
		if (b - a) % 10 != 0:
			resultados.append((b - a) // 10 + 1)
		else:
			resultados.append((b - a) // 10)
	if b - a < 0:
		if (b - a) % 10 != 0:
			resultados.append((a - b) // 10 + 1)
		else:
			resultados.append((a - b) // 10)
	if b - a == 0:
		resultados.append(0)
for i in resultados:
	print(i)


l = []
for i in range(int(input())):
	(a, b) = map(int, input().split())
	if abs(a - b) % 10 != 0:
		k = abs(a - b) // 10 + 1
	else:
		k = abs(a - b) // 10
	l.append(k)
for i in l:
	print(i)


t = int(input())
for tests in range(t):
	(a, b) = map(int, input().split())
	print((abs(b - a) + 9) // 10)


n = int(input())
for t in range(n):
	s = input()
	(a, b) = s.split()
	(a, b) = (int(a), int(b))
	d = a - b
	if d < 0:
		d *= -1
	c = 0
	if d == 0:
		print(0)
	else:
		for i in range(10, 0, -1):
			c += d // i
			d = d % i
			if d == 0:
				break
		print(c)


import math

def calc(a, b):
	return math.ceil(abs(b - a) / 10)
n = int(input())
for i in range(n):
	line = input().split()
	a = int(line[0])
	b = int(line[1])
	print(calc(a, b))


from sys import stdin, stdout
for jkl in range(int(stdin.readline())):
	num = [int(x) for x in stdin.readline().split()]
	if num[0] == num[1]:
		print(0)
	elif num[1] > num[0]:
		if (num[1] - num[0]) % 2 == 1:
			print(1)
		else:
			print(2)
	elif num[1] < num[0]:
		if (num[1] - num[0]) % 2 == 0:
			print(1)
		else:
			print(2)


def main():
	t = int(input())
	for _ in range(t):
		(a, b) = [int(x) for x in input().split()]
		if a == b:
			print(0)
			continue
		diff = abs(a - b)
		steps = diff // 10
		if diff % 10 != 0:
			steps += 1
		print(steps)
main()


t = int(input())

def Mod(n, m):
	if abs(n - m) < 10:
		if n == m:
			return 0
		else:
			return 1
	elif abs(n - m) % 10 == 0:
		return abs(n - m) // 10
	else:
		return 1 + abs(n - m) // 10
for i in range(t):
	A = list(map(int, input().split()))
	a = A[0]
	b = A[1]
	print(Mod(a, b))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if b < a:
		(a, b) = (b, a)
	print((b - a + 9) // 10)


import math
T = int(input())
for t in range(T):
	(A, B) = input().split()
	A = int(A)
	B = int(B)
	print(math.ceil(abs(B - A) / 10))


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	count = 0
	diff = abs(a - b)
	if diff != 0:
		count += diff // 10
		if diff % 10 != 0:
			count += 1
	print(count)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def solve(a, b):
	if a > b:
		(a, b) = (b, a)
	if b == a:
		return 0
	return (b - a) // 10 + (1 if (b - a) % 10 else 0)
lines = inp()
for i in range(lines):
	v = inlt()
	print(solve(*v))


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


import sys
import math
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
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = int(input())
for tt in range(t):
	(a, b) = map(int, sys.stdin.readline().split(' '))
	d = abs(b - a)
	v = d // 10
	if d % 10 == 0:
		print(v)
	else:
		print(v + 1)
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


t = int(input())
while t > 0:
	(a, b) = [int(i) for i in input().split()]
	ans = abs(b - a) // 10 + (abs(b - a) % 10 != 0)
	print(ans)
	t -= 1


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(a1, b1) = (a, b)
	ans = 0
	if a < b:
		dif = b - a
		ans += dif // 10
		if dif % 10 != 0:
			ans += 1
	elif b < a:
		dif = a - b
		ans += dif // 10
		if dif % 10 != 0:
			ans += 1
	print(ans)


def solve():
	(a, b) = map(int, input().split())
	res = abs(a - b)
	if res % 10 == 0:
		return res // 10
	else:
		return res // 10 + 1
for __ in range(int(input())):
	print(solve())


def check(a, b):
	step = (b - b % 10 - (a - a % 10)) // 10
	if a % 10 < b % 10:
		step += 1
	return step
I = input
t = int(I())
for i in range(t):
	(a, b) = map(int, I().split())
	if a == b:
		print(0)
	elif a > b:
		print(check(b, a))
	else:
		print(check(a, b))


import math

def addorsub(num, test):
	if num > test:
		return False
	else:
		return True

def step(x, y):
	difference = abs((x - y) / 10)
	print(math.ceil(difference))
iter = int(input())
ip = []
for i in range(iter):
	inp = input()
	ip.append(inp)
for ele in ip:
	(n1, n2) = ele.split(' ')
	n1 = int(n1)
	n2 = int(n2)
	if n1 == n2:
		print(0)
	elif addorsub(n1, n2):
		step(n1, n2)
	elif abs(n1 - n2 <= 10):
		print(1)
	else:
		step(n2, n1)


from bisect import bisect_right

def no_op(a: int, b: int, k_val: list) -> int:
	count = 0
	diff = abs(a - b)
	while diff:
		index = bisect_right(k_val, diff)
		if index != 0:
			count += diff // k_val[index - 1]
			diff %= k_val[index - 1]
	return count
T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split())
	k_val = list(range(1, 11))
	print(no_op(a, b, k_val))


for i in range(int(input())):
	(n, x) = map(int, input().split())
	print((abs(n - x) + 9) // 10)


t = int(input())
k = 10
for i in range(t):
	c = 1
	(a, b) = map(int, input().split())
	if a == b:
		c = 0
		print(c)
	else:
		d = abs(a - b)
		k1 = d // k
		r = d % k
		if r == 0:
			c = 0
			c += k1
			print(c)
		else:
			c += k1
			print(c)


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


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		t = a
		a = b
		b = t
	k = (b - a) // 10
	print(k if k * 10 == b - a else k + 1)


from collections import *
import sys

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
t = ri()
for _ in range(t):
	(a, b) = rl()
	d = abs(b - a)
	q = d // 10
	if 10 * q == d:
		print(q)
	else:
		print(q + 1)


n = int(input())
answer = []
for i in range(n):
	(a, b) = map(int, input().split())
	if a == b:
		answer.append('0')
		continue
	c = int(abs(a - b) / 10)
	if (a - b) % 10 != 0:
		c += 1
	answer.append(str(c))
print('\n'.join(answer))


t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	p = abs(n - k)
	if p % 10 == 0:
		print(p // 10)
	else:
		print(p // 10 + 1)
	t -= 1


__author__ = 'Md. Imrul Hasan @UAP-CSE'

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


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	c = abs(a - b)
	print(c // 10 + (c % 10 > 0))


from math import floor

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


import math
t = int(input())
for z in range(t):
	(a, b) = [int(q) for q in input().split()]
	d = abs(b - a)
	print(int(math.ceil(d / 10)))


import math
t = int(input())
for j in range(t):
	(a, b) = map(int, input().split())
	count = math.ceil(abs(a - b) / 10)
	print(count)


inp = input
li = list
iinp = lambda : int(inp())
ent = lambda : map(int, inp().split())
lient = lambda : li(ent())
t = iinp()
res = []
for _ in range(t):
	(a, b) = ent()
	if a == b:
		res.append(0)
	elif a > b:
		tmp = a - b
		if tmp % 2 == 0:
			res.append(1)
		else:
			res.append(2)
	elif a < b:
		tmp = b - a
		if tmp % 2 != 0:
			res.append(1)
		else:
			res.append(2)
for i in res:
	print(i)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	ans = 0
	d = 10
	x = abs(a - b)
	while x > 0 and d > 0:
		p = x // d
		ans += p
		x = x % d
		d -= 1
	print(ans)


import os
from sys import stdin, stdout

def solve(tc):
	(a, b) = map(int, stdin.readline().split())
	diff = abs(a - b)
	ans = diff // 10
	if diff % 10:
		ans += 1
	print(ans)
tcs = 1
tcs = int(stdin.readline().strip())
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


for t in range(int(input())):
	s = 0
	h = 0
	(l, m) = map(int, input().split())
	if l == m:
		print('0')
	elif l > m:
		if (l - m) % 2 == 0:
			print('1')
		else:
			print('2')
	elif (m - l) % 2 == 0:
		print('2')
	else:
		print('1')


import sys
input = sys.stdin.readline
(inp, ip) = (lambda : int(input()), lambda : [int(w) for w in input().split()])
for _ in range(inp()):
	(a, b) = ip()
	d = abs(a - b)
	print((d - 1) // 10 + 1)


no = int(input())
for i in range(no):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	d = c % 10
	c = c - d
	c = c // 10
	if d != 0:
		c += 1
	print(c)


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	p = max(a, b)
	q = min(a, b)
	i = p - q
	print(math.ceil(i / 10))


import math
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	n = abs(a - b)
	count = 0
	for i in range(10, 0, -1):
		temp = n // i
		count += temp
		n -= temp * i
		if n == 0:
			break
	print(count)


num = int(input())
for val in range(num):
	num_list = [int(val) for val in input().split()]
	store = abs(num_list[0] - num_list[1])
	if store % 10 == 0:
		print(store // 10)
	else:
		print(store // 10 + 1)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ans = 0
	while a != b:
		if a < b:
			for j in range(10, 0, -1):
				x = b - a
				ans += x // j
				a += x // j * j
		else:
			for j in range(10, 0, -1):
				x = a - b
				ans += x // j
				b += x // j * j
	print(ans)


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


t = int(input())
for h in range(t):
	(n1, n2) = map(int, input().split())
	dif = abs(n2 - n1)
	ans = 0
	for i in range(1, 11):
		x = dif // (11 - i)
		dif = dif - x * (11 - i)
		ans += x
		if dif == 0:
			break
	print(ans)


import sys
items = (tuple(map(int, line.split())) for line in sys.stdin)
for (idx, item) in enumerate(items):
	if idx == 0:
		continue
	(a, b) = item
	if a == b:
		print(0)
		continue
	print(abs(b - a) // 10 + int(abs(b - a) % 10 != 0))


for case in range(int(input())):
	(a, b) = [int(a) for a in input().split()]
	diff = abs(a - b)
	moves = diff // 10
	if diff % 10 == 0:
		print(moves)
	else:
		print(moves + 1)


import math
a = int(input())
for i in range(0, a):
	(m, n) = map(int, input().split())
	print(math.ceil(abs(n - m) / 10))


t = int(input())
for i in range(t):
	a = input()
	l = list(map(int, a.split()))
	c = max(l) - min(l)
	n = c // 10
	m = c % 10
	if not m == 0:
		m = 1
	print(m + n)


T = int(input())
for testcase in range(T):
	[a, b] = [int(i) for i in input().split()]
	result = (abs(b - a) - 1) // 10 + 1
	print(result)


import sys, math, bisect
from collections import Counter, defaultdict as dd

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

def out(var):
	sys.stdout.write(str(var))

def l():
	return list(sp())

def strl():
	return list(strsp())

def sp():
	return map(int, data().split())

def strsp():
	return map(str, data().split())
for _ in range(int(data())):
	(a, b) = sp()
	c = abs(a - b)
	if c == 0:
		print(0)
	elif c < 10:
		print(1)
	else:
		d = math.ceil(c / 10)
		print(d)


def operation(pairInt):
	module = abs(pairInt[0] - pairInt[1])
	if module == 0:
		return 0
	elif module % 10 == 0:
		return module // 10
	else:
		return module // 10 + 1
results = []
t = int(input())
for i in range(0, t):
	pairInt = list(map(int, input().split()))
	resultOfOper = operation(pairInt)
	results.append(resultOfOper)
for k in results:
	print(k)


import math
T = int(input())
while T != 0:
	st = list(input().split())
	a = int(st[0])
	b = int(st[1])
	x = math.ceil(abs(a - b) / 10)
	print(x)
	T = T - 1


def ab(a):
	if a >= 0:
		return a
	else:
		return -a
t = int(input())
for i in range(t):
	s = input().split()
	a = int(s[0])
	b = int(s[1])
	c = ab(a - b)
	if c % 10 == 0:
		print(c // 10)
	else:
		print(c // 10 + 1)


import sys
inp = sys.stdin.readline
out = sys.stdin.write

def minp(x):
	return map(int, x.split())

def linp(x):
	return list(minp(x))

def main():
	for _ in range(int(inp())):
		(a, b) = minp(inp())
		if abs(a - b) % 10 == 0:
			print(abs(a - b) // 10)
		else:
			print(abs(a - b) // 10 + 1)
main()


t = int(input())
output = []
for _ in range(t):
	l = list(map(int, input().split()))
	a = l[0]
	b = l[1]
	if a < b and (a + b) % 2 == 1:
		output.append('1')
		continue
	elif a < b:
		output.append('2')
		continue
	elif a > b and (a + b) % 2 == 1:
		output.append('2')
		continue
	elif a > b:
		output.append('1')
		continue
	output.append('0')
for o in output:
	print(o)


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


def readstr():
	return list(map(int, input().split()))
cases = readstr()[0]

def transform(a, b):
	steps = abs(a - b) // 10
	rem = abs(a - b) - steps * 10
	if rem > 0:
		steps += 1
	return steps
output = []
for _ in range(int(cases)):
	(a, b) = readstr()
	output.append(transform(a, b))
print('\n'.join(map(str, output)))


from typing import List
import collections
import bisect
import itertools
import functools
from collections import defaultdict
import collections
from fractions import gcd
import heapq
from math import ceil, sqrt
import sys
sys.setrecursionlimit(50000)
from collections import defaultdict
N = int(input())
for i in range(N):
	(a, b) = list(map(int, input().split()))
	diff = a - b
	if diff == 0:
		print(0)
	elif diff < 0:
		if abs(diff) % 2 == 1:
			print(1)
		else:
			print(2)
	elif abs(diff) % 2 == 1:
		print(2)
	else:
		print(1)


import math
from decimal import *
import random
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a >= b:
		val = a - b
		ans = val // 10
		val -= ans * 10
		if val > 0:
			ans += 1
		print(ans)
	else:
		val = b - a
		ans = val // 10
		val -= 10 * ans
		if val > 0:
			ans += 1
		print(ans)


t = int(input())
y = []
for i in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		y.append(0)
	elif a % 2 == 0 and b % 2 == 0 and (a > b):
		y.append(1)
	elif a % 2 == 0 and b % 2 == 0 and (a < b):
		y.append(2)
	elif a % 2 != 0 and b % 2 != 0 and (a > b):
		y.append(1)
	elif a % 2 != 0 and b % 2 != 0 and (a < b):
		y.append(2)
	elif a % 2 == 0 and b % 2 != 0 and (a < b):
		y.append(1)
	elif a % 2 == 0 and b % 2 != 0 and (a > b):
		y.append(2)
	elif a % 2 != 0 and b % 2 == 0 and (a < b):
		y.append(1)
	elif a % 2 != 0 and b % 2 == 0 and (a > b):
		y.append(2)
for i in range(len(y)):
	print(y[i])


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

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

def inputstring():
	return [x for x in input()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	(a, b) = inputnums()
	c = abs(a - b)
	ans = 0
	if c % 10 != 0:
		ans += 1
	ans += c // 10
	print(ans)


import math
d = list()
n = int(input())
for i in range(n):
	a = [int(x) for x in input().split()]
	a.sort()
	out = math.ceil((a[1] - a[0]) / 10)
	d.append(out)
for i in d:
	print(i)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	if a == b:
		print(0)
		continue
	if abs(a - b) <= 10:
		print(1)
		continue
	if abs(a - b) % 10 == 0:
		print(abs(a - b) // 10)
	else:
		print(abs(a - b) // 10 + 1)


import sys
infile = sys.stdin
next(infile)
for line in infile:
	l = list(map(int, line.split()))
	a = l[0]
	b = l[1]
	d = abs(a - b)
	if d % 10 == 0:
		print(d // 10)
	else:
		print(d // 10 + 1)


import sys
t = int(sys.stdin.readline().split()[0])
tests = [[0 for x in range(2)] for y in range(t)]
row = 0
for line in sys.stdin:
	column = 0
	for word in line.split():
		tests[row][column] = int(word)
		column += 1
	row += 1
for test in tests:
	a = test[0]
	b = test[1]
	if a == b:
		print(0)
	elif a < b:
		if (b - a) % 10 == 0:
			print(int((b - a) / 10))
		else:
			print((b - a) // 10 + 1)
	elif a > b:
		if (a - b) % 10 == 0:
			print(int((a - b) / 10))
		else:
			print((a - b) // 10 + 1)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		i = 0
		A = abs(a - b)
		if A % 10 > 0:
			i = 1
		print(i + A // 10)


from math import ceil
query = int(input())
for _ in range(query):
	(n, m) = map(int, input().split())
	d = abs(n - m)
	print(ceil(d / 10))


from math import ceil as cc

def mi():
	return map(int, input().split())
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)


import math
k = int(input())
for x in range(k):
	(a, b) = map(int, input().split(' '))
	result = 0
	print(math.ceil((max(a, b) - min(a, b)) / 10))


t = int(input())
lst = []
for _ in range(t):
	(a, b) = map(int, input().split())
	count = 0
	if abs(a - b) in range(1, 11):
		count += 1
	elif abs(a - b) == 0:
		count = 0
	else:
		x = abs(a - b) // 10
		if abs(a - b) % 10 == 0:
			count += x
		else:
			count += x + 1
	lst.append(count)
for i in range(t):
	print(lst[i])


t = int(input())
while t > 0:
	t -= 1
	(a, b) = list(map(int, input().split(' ')))
	if a == b:
		print(0)
	elif a < b and (a % 2 != 0 and b % 2 == 0 or (a % 2 == 0 and b % 2 != 0)):
		print(1)
	elif a < b and (a % 2 != 0 and b % 2 != 0 or (a % 2 == 0 and b % 2 == 0)):
		print(2)
	elif a > b and (a % 2 != 0 and b % 2 == 0 or (a % 2 == 0 and b % 2 != 0)):
		print(2)
	elif a > b and (a % 2 != 0 and b % 2 != 0 or (a % 2 == 0 and b % 2 == 0)):
		print(1)


import sys
tests = int(input())
for i in range(tests):
	(a, b) = map(int, sys.stdin.readline().split())
	if a == b:
		print(0)
	elif a % 2 == 0 and b % 2 == 0 and (a < b):
		print(2)
	elif a % 2 == 0 and b % 2 == 0 and (a > b):
		print(1)
	elif (a % 2 == 1 and b % 2 == 0 or (a % 2 == 0 and b % 2 == 1)) and a < b:
		print(1)
	elif (a % 2 == 1 and b % 2 == 0 or (a % 2 == 0 and b % 2 == 1)) and a > b:
		print(2)
	elif a % 2 == 1 and b % 2 == 1 and (a < b):
		print(2)
	elif a % 2 == 1 and b % 2 == 1 and (a > b):
		print(1)


n = int(input())
while n > 0:
	(a, b) = [int(x) for x in input().split()]
	count = 0
	if a > b:
		if (a - b) % 10 == 0:
			count = (a - b) // 10
		else:
			count = (a - b) // 10 + 1
	elif b > a:
		if (b - a) % 10 == 0:
			count = (b - a) // 10
		else:
			count = (b - a) // 10 + 1
	else:
		count = 0
	print(count)
	n -= 1


from sys import stdin
input = lambda : stdin.readline().strip()
import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = abs(b - a)
	if x != 0:
		print(math.ceil(x / 10))
	else:
		print(0)


n = int(input())
for i in range(n):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if a > b:
		x = a
		a = b
		b = x
	j = (b - a) // 10
	if a + 10 * j == b:
		print(j)
	else:
		print(j + 1)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	cnt = 0
	if a >= b:
		cnt += (a - b) // 10
		a -= (a - b) // 10 * 10
	else:
		cnt += (b - a) // 10
		a += (b - a) // 10 * 10
	if a == b:
		print(cnt)
	else:
		print(cnt + 1)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	s = 0
	k = 10
	l = abs(a - b)
	while l > 0:
		while l // k == 0:
			k -= 1
		s += l // k
		l = l % k
	print(s)


import math
testcasesNumber = int(input())
for number in range(testcasesNumber):
	(x, y) = [int(x) for x in input().split()]
	z = 0
	if x == y:
		print(0)
	else:
		n = abs(x - y)
		quotient = math.floor(n / 10)
		rem = n % 10
		if rem == 0:
			z = int(quotient)
		else:
			z = int(quotient) + 1
		print(z)


import sys

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	if b == a:
		print(0)
		continue
	elif (b - a) % 10 == 0:
		print(abs((b - a) // 10))
		continue
	if b < a:
		(a, b) = (b, a)
	print((b - a) // 10 + 1)


from abc import ABCMeta, abstractclassmethod

def isEven(num):
	return num % 2 == 0

def isOdd(num):
	return num % 2 == 1

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


def change(a, b):
	if a <= b:
		diff = b - a
		if diff == 0:
			return 0
		rem = 0
		step = 0
		if diff > 10:
			step += diff // 10
			diff = diff % 10
		if diff != 0:
			return step + 1
		else:
			return step
	else:
		return change(b, a)
t = int(input())
(x, y) = ([0] * t, [0] * t)
for i in range(t):
	(x[i], y[i]) = input().split()
for i in range(t):
	print(change(int(x[i]), int(y[i])))


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


def go():
	(a, b) = map(int, input().split())
	if a == b:
		return 0
	if a > b and a % 2 == b % 2:
		return 1
	if a < b and a % 2 != b % 2:
		return 1
	return 2
t = int(input())
ans = []
for _ in range(t):
	ans.append(str(go()))
print('\n'.join(ans))


for ___ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	tmp = abs(a - b)
	if tmp % 10 != 0:
		tmp = tmp // 10 + 1
	else:
		tmp = tmp // 10
	print(tmp)


n = int(input())
for j in range(n):
	count = 0
	(a, b) = map(int, input().split())
	if a == b:
		count = 0
	else:
		c = abs(a - b)
		if c % 10 < 10 and c % 10 > 0:
			count += 1
			count += int(c / 10)
		else:
			count += int(c / 10)
	print(count)


import os
import sys
import math
from io import BytesIO, IOBase

def main():
	t = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
	for _ in range(int(input())):
		(a, b) = [int(x) for x in sys.stdin.readline().split()]
		d = abs(a - b)
		i = 0
		count = 0
		while d > 0:
			if d // t[i] != 0:
				count += d // t[i]
				d -= d // t[i] * t[i]
			i += 1
		print(count)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
main()


t = int(input())
while t:
	(a, b) = map(int, input().split())
	ans = 0
	if a == b:
		ans = 0
	elif a > b:
		a -= b
		rem = a % 10
		div = a // 10
		ans += div
		if rem != 0:
			ans += 1
	elif a < b:
		a = b - a
		rem = a % 10
		div = a // 10
		ans += div
		if rem != 0:
			ans += 1
	print(ans)
	t -= 1


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop, heapify
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
from itertools import accumulate
from functools import lru_cache
M = mod = 10000

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	(a, b) = sorted(li())
	print(math.ceil((b - a) / 10))


for _ in range(int(input().strip())):
	(a, b) = tuple(map(int, input().strip().split()))
	ans = abs(a - b) / 10
	if int(ans) != ans:
		ans += 1
	print(int(ans))


tc = int(input())

def minMoves(a, b):
	d = abs(a - b)
	return d // 10 + (1 if d % 10 > 0 else 0)
for i in range(tc):
	s = input()
	(a, b) = s.split()
	print(minMoves(int(a), int(b)))


t = int(input())

def main(string):
	split = string.split()
	a = int(split[0])
	b = int(split[1])
	if a < b:
		return 1 if (a - b) % 2 == 1 else 2
	elif a > b:
		return 1 if (a - b) % 2 == 0 else 2
	else:
		return 0
results = []
for i in range(t):
	string = input()
	results.append(main(string))
for result in results:
	print(result)


for _ in range(int(input())):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	ans = abs(a // 10 - b // 10)
	if a > b and a % 10 > b % 10:
		ans += 1
	elif a < b and a % 10 < b % 10:
		ans += 1
	print(ans)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if b <= a:
		print(-((b - a) // 10))
	else:
		print(--abs((a - b) // 10))


def findmin(a, b):
	if a == b:
		return 0
	elif a > b:
		if (a - b) % 2 == 0:
			return 1
		else:
			return 2
	elif (b - a) % 2 != 0:
		return 1
	else:
		return 2
t = int(input())
for i in range(0, t):
	ab = list(map(int, input().split()))
	a = ab[0]
	b = ab[1]
	result = findmin(a, b)
	print(result)


x = int(input())
for i in range(x):
	(a, b) = [int(i) for i in input().split()]
	valor = abs(a - b)
	divisoes = valor // 10
	if valor % 10 != 0:
		divisoes += 1
	print(divisoes)


t = int(input())
while t > 0:
	lst1 = list(map(int, input().split()))
	maxer = int(max(lst1[0], lst1[1]) - min(lst1[0], lst1[1]))
	if maxer % 10 == 0:
		ans = maxer // 10
	else:
		ans = maxer // 10 + 1
	print(ans)
	t -= 1


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

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


t = int(input())
while t:
	(a, b) = map(int, input().split())
	if b != a:
		c = abs(b - a)
		c = c / 10
		c = str(c)
		for i in range(0, len(c)):
			if c[i] == '.':
				break
		if c[i + 1] != '0':
			c = float(c)
			c = int(c) + 1
		else:
			c = float(c)
			c = int(c)
	else:
		c = 0
	print(c)
	t -= 1


t_count = int(input().strip())
while t_count > 0:
	(a, b) = list(map(int, input().strip().split(' ')))
	diff = abs(a - b)
	moves = diff // 10
	if diff % 10:
		moves += 1
	print(moves)
	t_count -= 1


t = int(input())
for i in range(t):
	q = [int(el) for el in input().split()]
	a = q[0]
	b = q[1]
	k1 = min(a, b)
	k2 = max(a, b)
	d = k2 - k1
	if d % 10 == 0:
		print(d // 10)
	else:
		print(d // 10 + 1)


a = int(input())
for i in range(a):
	(b, c) = [int(x) for x in input().split()]
	if b == c:
		d = 0
	if b > c:
		d = b - c
	if b < c:
		d = c - b
	if d % 10 == 0:
		print(d // 10)
	if d % 10 != 0:
		print(d // 10 + 1)


import sys
rl = sys.stdin.readline
T = int(input())
for _ in range(T):
	(a, b) = map(int, rl().rstrip().split(' '))
	if a == b:
		print(0)
	elif a < b:
		if (b - a) % 2 == 0:
			print(2)
		else:
			print(1)
	elif (a - b) % 2 == 0:
		print(1)
	else:
		print(2)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	p = abs(b - a)
	print(p // 10 + (p % 10 != 0))


from math import ceil

def main():
	n = int(input())
	for i in range(n):
		(x, y) = map(int, input().split(' '))
		res = abs(x - y) / 10
		print(ceil(res))
main()


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


testCases = int(input())
differenceBetweenNumbers = 0
sumOfTwoNumbers = 0
MinNumberOfMoves = 0
for i in range(0, testCases):
	differenceBetweenNumbers = 0
	MinNumberOfMoves = 0
	(numberOne, numberTwo) = input().split()
	numberOne = int(numberOne)
	numberTwo = int(numberTwo)
	if numberOne == numberTwo:
		MinNumberOfMoves = 0
	elif numberOne > numberTwo:
		differenceBetweenNumbers = numberOne - numberTwo
		if differenceBetweenNumbers % 2 != 0:
			MinNumberOfMoves = 2
		else:
			MinNumberOfMoves = 1
	else:
		differenceBetweenNumbers = numberTwo - numberOne
		if differenceBetweenNumbers % 2 != 0:
			MinNumberOfMoves = 1
		else:
			MinNumberOfMoves = 2
	print(MinNumberOfMoves)


import math

def cal(a, b):
	return math.ceil(abs(a - b) / 10)
t = int(input())
while t:
	(a, b) = map(int, input().split())
	print(cal(a, b))
	t -= 1


t = int(input())
for tt in range(t):
	ab = input().split(' ')
	a = int(ab[0])
	b = int(ab[1])
	if a == b:
		print(0)
	if b > a and a % 2 != b % 2:
		print(1)
	if b > a and a % 2 == b % 2:
		print(2)
	if a > b and a % 2 == b % 2:
		print(1)
	if a > b and a % 2 != b % 2:
		print(2)


t = int(input())
for r in range(t):
	(a, b) = list(map(int, input().split()))
	c = abs(a - b) / 10
	if c == int(c):
		print(int(c))
	else:
		print(int(c) + 1)


import sys

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 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')
INF = 10 ** 19
MOD = 10 ** 9 + 7
for _ in range(INT()):
	(a, b) = MAP()
	dist = abs(a - b)
	ans = ceil(dist, 10)
	print(ans)


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	ans = 0
	difference = abs(a - b)
	divisor = difference // 10
	remind = difference % 10
	if remind != 0:
		ans += 1
	ans += divisor
	print(ans)


def solve():
	(a, b) = list(map(int, input().split()))
	if a < b:
		(a, b) = (b, a)
	print((a - b + 9) // 10)
ct = int(input())
while ct > 0:
	solve()
	ct -= 1


for n in range(int(input())):
	(a, b) = map(int, input().split())
	print((abs(a - b) + 9) // 10)


def solve(a, b):
	if a == b:
		print(0)
		return
	x = abs(a - b)
	req_moves = x // 10
	if x % 10 == 0:
		print(req_moves)
	else:
		print(req_moves + 1)
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	solve(a, b)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	is_odd = abs(b - a) & 1
	if b - a > 0 and is_odd or (b - a < 0 and (not is_odd)):
		print(1)
	else:
		print(2)


import sys
import math, bisect
sys.setrecursionlimit(10 ** 5)
from collections import defaultdict
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, OrderedDict

def I():
	return int(sys.stdin.readline())

def neo():
	return map(int, sys.stdin.readline().split())

def Neo():
	return list(map(int, sys.stdin.readline().split()))
for _ in range(I()):
	(a, b) = neo()
	(b, a) = (max(a, b), min(a, b))
	print(math.ceil((b - a) / 10))


def calcu(gr, lo):
	cal = (gr - lo) % 10
	if cal > 0:
		return int((gr - lo) / 10 + 1)
	else:
		return int((gr - lo) / 10)
n = int(input())
op = list(range(n))
k = list(range(2))
for i in range(n):
	str = input()
	k = str.split()
	z = 0
	for l in k:
		k[z] = int(l)
		z += 1
	a = k[0]
	b = k[1]
	da = a
	cntr = 0
	process = 0
	if da == b:
		cntr = 0
	elif da > b:
		cntr = calcu(da, b)
	elif da < b:
		cntr = calcu(b, da)
	op[i] = cntr
	k.clear()
for i in op:
	print(i)


import sys
t = int(sys.stdin.readline())
for i in range(t):
	line = sys.stdin.readline().split()
	(a, b) = (int(line[0]), int(line[1]))
	if a == b:
		print(0)
	elif a < b:
		if (b - a) % 2 == 0:
			print(2)
		else:
			print(1)
	elif (a - b) % 2 == 0:
		print(1)
	else:
		print(2)


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


import math
n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split(' '))
	if a == b:
		print('0')
	else:
		t = abs(a - b)
		v = math.floor(t / 10)
		z = max(a, b)
		if z - v * 10 == min(a, b):
			print(v)
		else:
			print(v + 1)


t = int(input())
l = list()
while t:
	st = input()
	b = st.find(' ')
	a = b
	b = int(st[:a])
	st = st[a + 1:]
	a = int(st)
	if b - a > 0:
		if (b - a) % 2 == 0:
			l.append(1)
		else:
			l.append(2)
	elif b - a < 0:
		if (a - b) % 2 == 0:
			l.append(2)
		else:
			l.append(1)
	else:
		l.append(0)
	t -= 1
for i in l:
	print(i)


def solve(a, b):
	diff = abs(a - b)
	if diff % 10 == 0:
		print(diff // 10)
	else:
		print(diff // 10 + 1)
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	solve(a, b)


import math
t = int(input())
while t > 0:
	(a, b) = [int(i) for i in input().split()]
	if a > b:
		ans = math.ceil((a - b) / 10)
	else:
		ans = math.ceil((b - a) / 10)
	print(ans)
	t -= 1


from math import ceil
for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	diff = abs(a - b)
	if a == b:
		print(0)
	else:
		print(ceil(diff / 10))


from math import ceil
t = int(input())
for i in range(0, t):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	ans = ceil(x / 10)
	print(ans)


from math import factorial
from collections import Counter
from heapq import heapify, heappop, heappush
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')
import bisect

def main():
	N = int(input())
	for _ in range(N):
		(a, b) = RL()
		dif = b - a
		if dif == 0:
			print(0)
		elif dif > 0:
			if dif % 2 == 1:
				print(1)
			else:
				print(2)
		elif dif % 2 == 0:
			print(1)
		else:
			print(2)
main()


import sys

def solve(A, n):
	if a == b:
		return 0
	elif abs(a - b) % 10 == 0:
		return abs(a - b) // 10
	else:
		return abs(a - b) // 10 + 1
t = int(input())
while t:
	t -= 1
	(a, b) = [i for i in map(int, input().strip().split())]
	print(solve(a, b))


i = int
cin = input
le = len
s = str
for _ in range(i(cin())):
	(a, b) = map(i, cin().split())
	if a == b:
		print(0)
	else:
		k = a - b
		if a < b:
			if k & 1:
				print(1)
			else:
				print(2)
		elif k & 1:
			print(2)
		else:
			print(1)


import sys
input = sys.stdin.readline
from bisect import bisect_left
from bisect import bisect_right
from math import ceil, factorial

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

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

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	(a, b) = int_array()
	x = abs(a - b)
	print(int(ceil(x / 10)))


for _ in '0' * int(input()):
	(a, b) = map(int, input().split())
	c = (a ^ b) & 1
	print(0 if a == b else 2 if c * (a > b) == 1 or (1 - c) * (a < b) == 1 else 1)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	r = abs(b - a) // 10
	if abs(b - a) // 10 == abs(b - a) / 10:
		ans = r
	else:
		ans = r + 1
	print(ans)


def solve(A):
	(a, b) = (A[0], A[1])
	(a, b) = (abs(a), abs(b))
	mx = max(a, b)
	mn = min(a, b)
	diff = mx - mn
	q = diff // 10
	m = diff % 10
	if m != 0:
		q += 1
	return q
res = []
t = int(input())
while t:
	arr = input().split(' ')
	A = [int(n) for n in arr]
	res.append(solve(A))
	t -= 1
for r in res:
	print(r)


r = int(input())
for i in range(r):
	(m, n) = map(lambda x: int(x), input().split())
	d = m - n
	if d == 0:
		print(0)
	elif d < 0 and d % 2 == 0 or (d > 0 and d % 2 != 0):
		print(2)
	elif d < 0 and d % 2 != 0 or (d > 0 and d % 2 == 0):
		print(1)


n = int(input())
res = ''
for x in range(n):
	(a, b) = map(int, input().split())
	k = max(a, b) - min(a, b)
	c = 0
	if k >= 10:
		c += k // 10
		k %= 10
	if k <= 0:
		res += str(c) + '\n'
	else:
		c += 1
		res += str(c) + '\n'
res = res.strip('\n')
print(res)


t = int(input())
s = []

def df(a, b):
	if a == b:
		return 0
	elif a < b and (a - b) % 2 != 0:
		return 1
	elif a < b and (a - b) % 2 == 0:
		return 2
	elif a > b and abs(a - b) % 2 == 0:
		return 1
	elif a > b and abs(a - b) % 2 != 0:
		return 2
for i in range(t):
	(a, b) = map(int, input().split())
	k = df(a, b)
	s.append(k)
for item in s:
	print(item)


t = int(input())
out = []

def find(a, b):
	m = a - b
	n = m % 10
	if n != 0:
		out.append(m // 10 + 1)
	else:
		out.append(m // 10)
for i in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		find(a, b)
	else:
		find(b, a)
for i in out:
	print(i)


import math
no = int(input())
lst = list()
for i in range(no):
	x = input()
	lst.append(x)

def minmove(num1, num2):
	diff = abs(num1 - num2) / 10
	print(math.ceil(diff))
for j in lst:
	(num1, num2) = j.split(' ')
	num1 = int(num1)
	num2 = int(num2)
	if num1 == num2:
		print(0)
	else:
		minmove(num1, num2)


T = int(input())
for i in range(T):
	(a, b) = [int(s) for s in input().split()]
	count = 0
	if a == b:
		print(0)
	elif abs(a - b) < 10:
		print(1)
	elif abs(a - b) % 10 == 0:
		print(abs(a - b) // 10)
	else:
		print(abs(a - b) // 10 + 1)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		ans = 0
	elif a > b:
		c = a - b
		d = c // 10
		m = c % 10
		if m == 0:
			ans = d
		else:
			ans = 1 + d
	elif a < b:
		c = b - a
		d = c // 10
		m = c % 10
		if m == 0:
			ans = d
		else:
			ans = 1 + d
	print(ans)


for x in range(int(input())):
	(a, b) = map(int, input().split())
	moves = 0
	if b == a:
		pass
	elif abs(a - b) % 10 == 0:
		moves = abs(a - b) // 10
	else:
		moves = abs(a - b) // 10 + 1
	print(moves)


n = int(input())
l = []
for i in range(n):
	(a, b) = map(int, input().split())
	k = abs(a - b)
	if k == 0:
		ans = 0
	elif k > 10:
		if k % 10 == 0:
			ans = k // 10
		else:
			k = k // 10
			ans = 1 + k
	else:
		ans = 1
	l.append(ans)
for j in l:
	print(j)


def f(a, b):
	return (abs(a - b) + 10 - 1) // 10
results = []
for _ in range(int(input())):
	(a, b) = map(int, input().split(' '))
	print(f(a, b))


t = int(input())
while t:
	l = [int(i) for i in input().split()]
	l.sort()
	c = l[1] - l[0]
	if l[0] == l[1]:
		print('0')
	elif l[0] < l[1]:
		d = c % 10
		c = (c - d) / 10
		if d == 0:
			print(int(c))
		else:
			print(int(c + 1))
	t -= 1


t = int(input())
x = []
for _ in range(t):
	x.append([int(i) for i in input().split()])
for i in x:
	if i[0] == i[1]:
		print(0)
		continue
	if i[0] < i[1]:
		y = i[1] - i[0]
		if y % 2 == 0:
			print(2)
		else:
			print(1)
	if i[0] > i[1]:
		y = i[0] - i[1]
		if y % 2 == 0:
			print(1)
		else:
			print(2)


import math

def solve(a, b):
	return math.ceil(abs(b - a) / 10)
t = int(input())
for t in range(t):
	(a, b) = [int(s) for s in input().split()]
	result = solve(a, b)
	print(result)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	k = abs(a - b)
	print(k // 10 + int(k % 10 != 0))


test = []
ans = []
for i in range(int(input())):
	y = input().split()
	y[0] = int(y[0])
	y[1] = int(y[1])
	test.append(y)
for i in range(len(test)):
	if test[i][0] == test[i][1]:
		ans.append(0)
	elif test[i][0] < test[i][1]:
		if abs(test[i][0] - test[i][1]) % 2 == 1:
			ans.append(1)
		else:
			ans.append(2)
	elif abs(test[i][0] - test[i][1]) % 2 == 1:
		ans.append(2)
	else:
		ans.append(1)
for i in ans:
	print(i)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	one = abs(b - a) // 10
	two = (b - a) % 10 != 0
	print(one + two)


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


from sys import stdin, stdout
from math import ceil

class SOLVE:

	def solve(self):
		R = stdin.readline
		W = stdout.write
		ans = []
		for i in range(int(input())):
			(a, b) = [int(x) for x in R().split()]
			ans += [str(ceil(abs(a - b) / 10))]
		W('\n'.join(ans))

def main():
	s = SOLVE()
	s.solve()
main()


ni = int(input())
for ki in range(ni):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	if a < b:
		c = b - a
		if not c % 10:
			print(c // 10)
			continue
		print(c // 10 + 1)
		continue
	c = a - b
	if not c % 10:
		print(c // 10)
		continue
	print(c // 10 + 1)
	continue


from sys import stdin
from math import ceil
t = int(stdin.readline())
for _ in range(t):
	(a, b) = map(int, stdin.readline().split())
	if a == b:
		print(0)
	elif a > b:
		tmp = a - b
		print(int(ceil(tmp / 10)))
	elif a < b:
		tmp = b - a
		print(int(ceil(tmp / 10)))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	result = 0
	while a < b:
		diff = b - a
		for i in reversed(range(1, 11)):
			if diff // i > 0:
				a += i * (diff // i)
				result += diff // i
				break
	print(result)


cases = int(input())
for i in range(cases):
	line = input().split(' ')
	a = int(line[0])
	b = int(line[1])
	diff = abs(a - b)
	sol = 0
	sol += diff // 10
	if diff % 10 > 0:
		sol += 1
	print(sol)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	B = max(a, b)
	A = min(a, b)
	if (B - A) % 10 == 0:
		print(int((B - A) / 10))
	else:
		print(int((B - A) / 10 + 1))


from math import ceil
for i in range(int(input())):
	(lambda x: print(ceil(abs(x[0] - x[1]) / 10)))(list(map(int, input().split())))


for _ in range(int(input())):
	inp = [int(i) for i in input().split(' ')]
	a = inp[0]
	b = inp[1]
	m = min(a, b)
	a -= m
	b -= m
	if (a + b) % 10 == 0:
		print((a + b) // 10)
	else:
		print((a + b) // 10 + 1)


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


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


import sys
from collections import defaultdict as dd
from collections import deque
from functools import *
from fractions import Fraction as f
from copy import *
from bisect import *
from heapq import *
from math import *
from itertools import permutations, product

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def inc(d, c):
	d[c] = d[c] + 1 if c in d else 1

def bo(i):
	return ord(i) - ord('A')

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def isvalid(i, j):
	return 0 <= i < n and 0 <= j < n

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = fi()
while t > 0:
	t -= 1
	(a, b) = mi()
	print(abs(a - b) // 10 + int(abs(a - b) % 10 > 0))


n = int(input())
output = []
for _ in range(n):
	lt = list(map(int, input().split()))
	if lt[0] == lt[1]:
		output.append('0')
	elif lt[0] > lt[1]:
		if (lt[0] - lt[1]) % 2 == 0:
			output.append('1')
		else:
			output.append('2')
	elif (lt[1] - lt[0]) % 2 == 0:
		output.append('2')
	else:
		output.append('1')
for i in output:
	print(i)


import math
import string
a = int(input())
for i in range(a):
	b = input().split(' ')
	c = int(b[0])
	d = int(b[1])
	counter = 0
	if c != d:
		if c > d:
			if (c + d) % 2 == 0:
				counter = 1
			else:
				counter = 2
		elif (c + d) % 2 == 0:
			counter = 2
		else:
			counter = 1
	print(counter)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	count = 0
	while a != b:
		if a > b:
			if a - b >= 10:
				res = a - b
				count += res // 10
				a -= int(str(count) + '0')
			elif a - b < 10:
				a -= a - b
				count += 1
		elif b > a:
			if b - a >= 10:
				res = abs(b - a)
				count += res // 10
				a += int(str(count) + '0')
			elif b - a < 10:
				a += b - a
				count += 1
	print(count)


def f():
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		if a < b:
			(a, b) = (b, a)
		x = (a - b + 9) // 10
		print(x)
for i in range(int(input())):
	f()


inp = int(input())
for i in range(inp):
	input1 = input()
	inp_lst = input1.split(' ')
	a = int(inp_lst[0])
	b = int(inp_lst[1])
	count = 0
	while a != b:
		if a < b:
			diff = b - a
			if diff % 2 == 1:
				count += 1
				a += diff
			else:
				a += diff - 1
				count += 1
		elif a > b:
			diff = a - b
			if diff % 2 == 0:
				count += 1
				a -= diff
			else:
				a -= diff + 1
				count += 1
	print(count)


num = int(input())
c = []
for _ in range(num):
	count = 0
	l1 = input().split()
	(a, b) = (max(int(l1[0]), int(l1[1])), min(int(l1[0]), int(l1[1])))
	diff = a - b
	strnum = str(diff)
	x = diff / 10
	p = diff % 10
	if p != 0:
		p = 1
	count = p + x
	c.append(int(count))
for i in c:
	print(i)


from functools import lru_cache
from sys import stdin, stdout
import sys
from math import *
for __ in range(int(input())):
	(a, b) = map(int, input().split())
	print(ceil(abs(a - b) / 10))


def moves(a, b):
	if a > b:
		return moves(b, a)
	if a == b:
		return 0
	num = 0
	while b - a > 10:
		f = (b - a) // 10
		num += f
		b = b - f * 10
	if b - a == 0:
		return num
	else:
		return num + 1
t = int(input())
while t:
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	print(moves(a, b))
	t -= 1


TC = int(input())
while TC > 0:
	(a, b) = list(map(int, input().split()))
	print((abs(b - a) + 9) // 10)
	TC -= 1


from sys import stdin
tc = int(stdin.readline())
for x in range(tc):
	(a, b) = [int(x) for x in stdin.readline().strip().split(' ')]
	if a == b:
		print(0)
	else:
		ans = abs(b - a) + 9
		print(ans // 10)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	c = 0
	if a >= b:
		c = b
		b = a
		a = c
	r = b - a
	if r == 0:
		print(0)
	elif r < 10 and r != 0:
		print(1)
	elif r % 10 == 0:
		print(int(r / 10))
	else:
		print(int(r // 10 + 1))


t = int(input())
for _ in range(t):
	line = input()
	pui = line.split()
	a = int(pui[0])
	b = int(pui[1])
	dif = abs(a - b)
	s = int(dif / 10)
	if dif % 10 != 0:
		s += 1
	print(s)


from math import ceil
test = int(input())
for i in range(test):
	(a, b) = list(map(int, input().split()))
	if a == b:
		print(0)
	elif a > b:
		x = ceil((a - b) / 10)
		print(x)
	else:
		y = ceil((b - a) / 10)
		print(y)


import atexit
import io
import sys
import math
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	c = 0
	if a == b:
		print(0)
		continue
	if b > a:
		if (b - a) % 2 == 0:
			c = 2
		else:
			c = 1
	elif abs(b - a) % 2 == 0:
		c = 1
	else:
		c = 2
	print(c)


import math

def arraysum(array1, array2):
	allsum = 0
	for i in range(len(array1)):
		allsum += abs(array1[i] - array2[i])
n = int(input())
for i in range(n):
	s = input().split(' ')
	a = int(s[0])
	b = int(s[1])
	print(int(math.ceil(abs(a - b) / 10)))


t = int(input())
q = []
for i in range(t):
	l = list(input().split())
	a = []
	for j in range(2):
		a.append(int(l[j]))
	if a[0] == a[1]:
		q.append(0)
	elif a[0] > a[1]:
		if a[0] % 2 != 0 and a[1] % 2 != 0 or (a[0] % 2 == 0 and a[1] % 2 == 0):
			q.append(1)
		else:
			q.append(2)
	elif a[0] % 2 != 0 and a[1] % 2 != 0 or (a[0] % 2 == 0 and a[1] % 2 == 0):
		q.append(2)
	else:
		q.append(1)
for i in q:
	print(i)


t = int(input())

def twointegers(a, b):
	if a == b:
		return 0
	if b - a < 10:
		return 1
	if (b - a) % 10 == 0:
		return (b - a) // 10
	return (b - a) // 10 + 1
for i in range(t):
	(a, b) = input().split()
	(a, b) = (min(int(a), int(b)), max(int(a), int(b)))
	print(twointegers(a, b))


m = int(input())
l = []
l2 = []
for i in range(m):
	a = list(map(int, input().split()))
	l.append(a)
for i in range(len(l)):
	num = l[i][-1] - l[i][0]
	if l[i][0] == l[i][1]:
		l2.append(0)
	elif l[i][0] >= l[i][1]:
		if num % 2 == 0:
			l2.append(1)
		elif num % 2 == 1:
			l2.append(2)
	elif l[i][0] <= l[i][1]:
		if num % 2 == 0:
			l2.append(2)
		elif num % 2 == 1:
			l2.append(1)
for i in range(len(l2)):
	print(l2[i])


t = int(input())
for _ in range(t):
	(a, b) = [int(x) for x in input().split()]
	r = abs(b - a) // 10
	if abs(b - a) % 10:
		r += 1
	print(r)


test = int(input())
for i in range(test):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	if a > b:
		c = a - b
		if c % 10 != 0:
			s = c // 10
			s += 1
			print(s)
		else:
			s = c // 10
			print(s)
	if b > a:
		c = b - a
		if c % 10 != 0:
			s = c // 10
			s += 1
			print(s)
		else:
			s = c // 10
			print(s)


import math
t = int(input())
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	count = 0
	res = math.ceil(abs((a - b) / 10))
	print(res)


import sys
input = sys.stdin.readline
read = lambda : map(int, input().split())
read_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

def lcm(a, b):
	return a * b // math.gcd(a, b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

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

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(l, ps, n, t):
	for i in range(n - l + 1):
		if ps[i + l] - ps[i] <= t:
			return True
	return False
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
import bisect as bis
import random
import sys

def solve():
	(a, b) = read()
	if b - a == 0:
		print(0)
		return
	if b - a > 0:
		if (b - a) % 2 == 1:
			print(1)
			return
		else:
			print(2)
			return
	elif b - a < 0:
		if abs(b - a) % 2 == 1:
			print(2)
			return
		else:
			print(1)
			return
for _ in range(int(input())):
	solve()


import math
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	ans = abs(m - n)
	ans = math.ceil(ans / 10)
	print(ans)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7
mod2 = 998244353

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

def out(var, end='\n'):
	sys.stdout.write(str(var) + end)

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	(a, b) = sp()
	temp = abs(b - a)
	answer = temp // 10 + (1 if temp % 10 else 0)
	out(answer)


def func(m, n):
	if m - n < 0 and (m - n) % 2 == 1:
		return 1
	elif m - n > 0 and (m - n) % 2 == 0:
		return 1
	elif m - n < 0 and (m - n) % 2 == 0:
		return 2
	elif m - n > 0 and (m - n) % 2 == 1:
		return 2
	else:
		return 0
q = int(input())
for _ in range(q):
	(m, n) = list(map(int, input().split()))
	print(func(m, n))


def two_nums():
	count = int(input())
	data_lst = []
	ans = []
	s = 0
	a = 0
	for i in range(count):
		data_lst = list(map(int, input().split()))
		if data_lst[0] > data_lst[1]:
			a = data_lst[0] - data_lst[1]
			if a % 10 == 0:
				ans.append(a // 10)
			else:
				ans.append(a // 10 + 1)
		elif data_lst[0] == data_lst[1]:
			ans.append(0)
		elif data_lst[0] < data_lst[1]:
			a = data_lst[1] - data_lst[0]
			if a % 10 == 0:
				ans.append(a // 10)
			else:
				ans.append(a // 10 + 1)
		data_lst = []
		s = 0
		a = 0
	for i in range(len(ans)):
		print(ans[i])
two_nums()


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	l = a - b
	j = abs(l)
	if a == b:
		print(0)
	elif j % 2 == 0:
		if l > 0:
			print(1)
		else:
			print(2)
	elif l > 0:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	l = list(range(1, 11))
	if a == b:
		print('0')
	elif a < b:
		c = b - a
		count = 0
		for i in range(10, 0, -1):
			d = c // i
			count = count + d
			c = c % i
			if c == 0:
				break
		print(count)
	elif a > b:
		c = a - b
		count = 0
		for i in range(10, 0, -1):
			d = c // i
			count = count + d
			c = c % i
			if c == 0:
				break
		print(count)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	ans = 0
	if b > a:
		if (b - a) % 2 == 0:
			ans = min(2, b - a)
		else:
			ans = 1
	if b == a:
		ans = 0
	if b < a:
		ans = (a - b) % 2 + 1
	print(ans)


t = int(input())
natija = []
for i in range(t):
	L = input().split(' ')
	a = int(L[0])
	b = int(L[1])
	if abs(a - b) % 10 == 0:
		natija.append(abs(a - b) // 10)
	else:
		natija.append(abs(a - b) // 10 + 1)
for i in range(t):
	print(natija[i])


w = int(input())
for i in range(w):
	(a, b) = tuple(map(int, input().split()))
	diff = abs(a - b)
	print((diff + 9) // 10)


from math import *
from collections import *
from itertools import *
from functools import *
from bisect import *
from heapq import *
from operator import *
from sys import *
setrecursionlimit(100000000)
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	x = abs(b - a)
	ans = x // 10 + (1 if x % 10 else 0)
	print(ans)


a = int(input())
for k in range(a):
	sum = 0
	b = list(map(int, input().split()))
	if b[0] == b[1]:
		print(0)
	else:
		if b[1] % 2 == 0 and b[0] % 2 == 0:
			if b[1] > b[0]:
				print(2)
			else:
				print(1)
		if b[0] % 2 != b[1] % 2:
			if b[1] > b[0]:
				print(1)
			else:
				print(2)
		if b[1] % 2 != 0 and b[0] % 2 != 0:
			if b[1] > b[0]:
				print(2)
			else:
				print(1)


an = 0
t = int(input())
for i in range(t):
	(x, y) = list(map(int, input().split()))
	if x != y:
		an = abs(x - y)
		ans = an // 10
		rem = an % 10
		if rem == 0:
			print(ans)
		else:
			print(ans + 1)
	else:
		print(0)


def read_tokens():
	return input().strip().split(' ')

def read_ints():
	return [int(s) for s in read_tokens()]

def min_op(a, b) -> int:
	diff = a - b
	if diff == 0:
		return 0
	if diff > 0:
		is_even = diff % 2 == 0
		if is_even:
			return 1
		else:
			return 2
	diff = -diff
	is_even = diff % 2 == 0
	if is_even:
		return 2
	else:
		return 1
(T,) = read_ints()
for test in range(T):
	(a, b) = read_ints()
	print(min_op(a, b))


def yetAnother(a, b):
	if a == b:
		return 0
	else:
		return (max(a, b) - min(a, b)) // 10 + 1 if (max(a, b) - min(a, b)) % 10 != 0 else (max(a, b) - min(a, b)) // 10
n = int(input())
lst = []
for i in range(n):
	(l, m) = [int(x) for x in input().split()]
	lst.append(yetAnother(l, m))
for i in lst:
	print(i)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
numeroCasos = inp()
inputs = []
for i in range(0, numeroCasos):
	entrada = list(map(int, input().split(' ')))
	inputs.append(entrada)

def calcularIntentos(a, b):
	diferencia = abs(b - a)
	if diferencia == 0:
		print(0)
	elif diferencia % 10 == 0:
		intentos = diferencia // 10
		print(intentos)
	else:
		intentos = diferencia // 10 + 1
		print(intentos)
for entrada in inputs:
	calcularIntentos(entrada[0], entrada[1])


from sys import stdin
import math

def readline():
	return stdin.readline()

def solve(a, b):
	m = abs(a - b)
	s = 0
	if m > 10:
		s = math.ceil(m / 10)
	elif m > 0:
		s = 1
	return s
tests = int(readline())
for t in range(0, tests):
	(a, b) = list(map(int, readline().rstrip('\n').split(' ')))
	print(solve(a, b))


tests = int(input())
for test in range(tests):
	num_str = input()
	num_list = num_str.split()
	a = int(num_list[0])
	b = int(num_list[1])
	c = a - b
	if c == 0:
		count = 0
	if c < 0:
		if c % 2 != 0:
			count = 1
		elif c % 2 == 0:
			count = 2
	if c > 0:
		if c % 2 == 0:
			count = 1
		elif c % 2 != 0:
			count = 2
	print(count)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a < b:
		ans1 = (b - a) // 10
		ans2 = (b - a) % 10
		if ans2 == 0:
			ans3 = ans1
		else:
			ans3 = ans1 + 1
		print(ans3)
	elif a > b:
		ans1 = (a - b) // 10
		ans2 = (a - b) % 10
		if ans2 == 0:
			ans3 = ans1
		else:
			ans3 = ans1 + 1
		print(ans3)
	else:
		print(0)


T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split())
	res = 0
	c = abs(a - b)
	for i in range(10, 0, -1):
		res += c // i
		c %= i
	print(res)


def solution():
	from sys import stdout, stdin
	(_input, _print) = (stdin.readline, stdout.write)
	for i in range(int(_input())):
		(a, b) = [int(i) for i in _input().split()]
		if a == b:
			print(0)
		elif a % 2 == 0:
			if b % 2 == 0 and a > b:
				print(1)
			elif b % 2 == 1 and a < b:
				print(1)
			else:
				print(2)
		elif b % 2 == 1 and a > b:
			print(1)
		elif b % 2 == 0 and a < b:
			print(1)
		else:
			print(2)
solution()


def calc(a, b):
	delta = b - a
	cnt = 0
	while delta:
		cnt += 1
		if delta > 0:
			delta = delta if delta % 2 else delta - 1
		else:
			delta = delta - 1 if delta % 2 else delta
		a += delta
		delta = b - a
	return cnt
for i in range(int(input())):
	(a, b) = map(int, input().split())
	print(calc(a, b))


def convert(a, b):
	if a == b:
		return 0
	if b > a:
		if (b - a) % 2 != 0:
			return 1
		else:
			return 2
	elif (b - a) % 2 == 0:
		return 1
	else:
		return 2

def io():
	T = int(input())
	for i in range(T):
		(a, b) = map(int, input().split())
		print(convert(a, b))
io()


testCases = int(input())
for _ in range(testCases):
	l = list(map(int, input().split(' ')))
	(a, b) = (l[0], l[1])
	knt = 0
	if a - b < 0:
		diff = b - a
		knt += int(diff / 10)
		if diff % 10 != 0:
			knt += 1
	elif a - b > 0:
		diff = a - b
		knt += int(diff / 10)
		if diff % 10 != 0:
			knt += 1
	print(knt)


import math
g = int(input())
for t in range(g):
	(means, end) = map(int, input().split())
	c = (end - means) / 10
	print(math.ceil(abs(c)))


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	move_count = 0
	done = False
	while not done:
		if a == b:
			print(move_count)
			done = True
			break
		elif b > a:
			x = b - a
			if x % 2 == 0:
				a = a + 1
				move_count += 1
			else:
				a = a + x
				move_count += 1
		elif a > b:
			x = a - b
			if x % 2 == 0:
				a = a - x
				move_count += 1
			else:
				a = a - x - 1
				move_count += 1


def s():
	t = int(input())
	while t:
		(a, b) = map(int, input().split(' '))
		tot = abs(a - b)
		if tot % 10 > 0:
			print(int(tot / 10) + 1)
		else:
			print(int(tot / 10))
		t = t - 1
s()


t = int(input())
for _ in range(t):
	(a, b) = sorted([int(i) for i in input().split()])
	print((b - a) // 10 + ((b - a) % 10 != 0))


import math
for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	print(math.ceil((max(a, b) - min(a, b)) / 10))


n = int(input())
for i in range(n):
	a = list(map(int, input().split()))
	a.sort()
	[a, b] = a
	if (b - a) % 10 > 0:
		ans = 1
	else:
		ans = 0
	ans += (b - a) // 10
	print(ans)


import math
t = int(input())
while t > 0:
	(a, b) = [int(i) for i in input().split()]
	if a == b:
		print(0)
		t -= 1
		continue
	else:
		if a > b:
			(a, b) = (b, a)
		x = b - a
		c = int(math.ceil(x / 10))
		print(c)
	t -= 1


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	ans = (b - a) // 10 + ((b - a) % 10 > 0)
	print(ans)


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	(a, b) = map(int, sys.stdin.readline().split())
	if a == b:
		print(0)
	elif a > b:
		print(1 + abs(a % 2 - b % 2))
	else:
		print(2 - abs(a % 2 - b % 2))


x = int(input())
for i in range(0, x):
	(n, m) = [int(a) for a in input().split()]
	d = abs(n - m)
	if d > 10:
		if d % 10 == 0:
			print(d // 10)
		else:
			print(d // 10 + 1)
	elif d == 0:
		print(d)
	else:
		print(1)


from math import ceil
for i in range(int(input())):
	(a, b) = map(int, input().split())
	v = abs(a - b)
	moves = v // 10
	val = v % 10
	if val > 0:
		moves += 1
	print(moves)


import sys
import os.path
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
	sys.stdout = open('out.txt', 'w')
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	dis = abs(a - b)
	ans = dis // 10
	if dis % 10 == 0:
		print(ans)
	else:
		print(ans + 1)


test_cases = int(input())
for z in range(test_cases):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if a > b:
		if (a - b) % 2 == 0:
			print('1')
		else:
			print('2')
	elif b > a:
		if (b - a) % 2 != 0:
			print('1')
		else:
			print('2')
	else:
		print('0')


t = int(input())
a = []
b = []
for i in range(t):
	c = input()
	a.append(int(c.split(' ')[0]))
	b.append(int(c.split(' ')[1]))
for i in range(len(a)):
	if b[i] - a[i] != 0:
		if b[i] - a[i] > 0:
			if b[i] - a[i] > 10:
				k = (b[i] - a[i]) // 10
				if b[i] - a[i] - k * 10 <= 0:
					print(k)
				else:
					print(k + 1)
			else:
				print(1)
		elif a[i] - b[i] > 10:
			k = (a[i] - b[i]) // 10
			if a[i] - b[i] - k * 10 <= 0:
				print(k)
			else:
				print(k + 1)
		else:
			print(1)
	else:
		print(0)


for i in range(int(input())):
	(p, q) = list(map(int, input().split()))
	c = 0
	a = min(p, q)
	b = max(p, q)
	while a != b:
		if abs(b - a) >= 10:
			x = abs(b - a) // 10
			b -= 10 * x
			c += x
		else:
			b -= abs(b - a)
			c += 1
	print(c)


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


def min_count(a, b):
	k = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
	count = 0
	if a == b:
		return 0
	else:
		tmp = abs(a - b)
		if int(tmp % 10) != 0:
			return int(tmp / 10) + 1
		else:
			return int(tmp / 10)
t = int(input())
res = []
for _ in range(t):
	(a, b) = input().rstrip().split()
	res.append(min_count(int(a), int(b)))
for i in res:
	print(i)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(l, r) = map(int, input().split())
	diff = abs(l - r)
	ans = 0
	ans += diff // 10
	diff %= 10
	ans += diff // 9
	diff %= 9
	ans += diff // 8
	diff %= 8
	ans += diff // 7
	diff %= 7
	ans += diff // 6
	diff %= 6
	ans += diff // 5
	diff %= 5
	ans += diff // 4
	diff %= 4
	ans += diff // 3
	diff %= 3
	ans += diff // 2
	diff %= 2
	ans += diff // 1
	diff %= 1
	print(ans)


import sys
for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	diff = abs(b - a)
	ans = diff // 10
	if diff % 10 != 0:
		ans += 1
	print(ans)


t = int(input())
for case in range(t):
	(a, b) = input().split(' ')
	(a, b) = (int(a), int(b))
	if a < b:
		print((b - a - 1) // 10 + 1)
	else:
		print((a - b - 1) // 10 + 1)


import sys
input = sys.stdin.readline
for n in range(int(input())):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	if d % 10 == 0:
		print(d // 10)
	else:
		print(d // 10 + 1)


n = int(input())
i = 0
b = []
while i < n:
	x = input()
	b.append(x)
	i = i + 1
for word in b:
	k = 0
	y = word.split(' ')
	p = abs(int(y[1]) - int(y[0]))
	if p <= 10 and p != 0:
		print('1')
	elif p == 0:
		print('0')
	elif p > 10:
		k = k + p // 10
		if p % 10 > 0:
			k = k + 1
			print(k)
		elif p % 10 == 0:
			print(k)


t = int(input())
for i in range(t):
	(a, b) = [int(j) for j in input().split()]
	d = abs(a - b)
	if d % 10 == 0:
		t1 = d // 10
	else:
		t1 = d // 10 + 1
	print(t1)


for _ in ' ' * int(input()):
	(a, b) = map(int, input().split())
	print(0 if a == b else 1 if a > b and (not (a - b) % 2) else 2 if a > b and (a - b) % 2 else 1 if (b - a) % 2 else 2)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	k = 0
	c = max(a, b) - min(a, b)
	k += c // 10
	c %= 10
	if c != 0:
		k += 1
	print(k)


def isEven(num: int):
	return not num % 2

def main():
	test_cases = int(input())
	outputs = []
	for each_case in range(test_cases):
		(a, b) = [int(x) for x in input().split()]
		if b - a == 0:
			outputs.append(0)
		else:
			res = a - b
			if res > 0:
				if isEven(res):
					outputs.append(1)
				else:
					outputs.append(2)
			elif isEven(res):
				outputs.append(2)
			else:
				outputs.append(1)
	for each_output in outputs:
		print(each_output)
main()


def readGenerator():
	while True:
		tokens = input().split(' ')
		for t in tokens:
			yield t
reader = readGenerator()

def readWord():
	return next(reader)

def readInt():
	return int(next(reader))

def readFloat():
	return float(next(reader))

def readLine():
	return input()

def solve(n):
	return n

def solve(a, b):
	return abs(a - b) // 10 + (0 if abs(a - b) % 10 == 0 else 1)
tests = readInt()
for _ in range(0, tests):
	a = readInt()
	b = readInt()
	print(solve(a, b))


test_cases = int(input())
results = []
for t in range(test_cases):
	nums = list(map(int, input().split()))
	(a, b) = (min(nums), max(nums))
	moves = 0
	for k in range(10, 0, -1):
		temp = (b - a) // k
		a += k * temp
		moves += temp
		if a == b:
			results.append(moves)
			break
for res in results:
	print(res)


import sys
read = lambda : sys.stdin.readline().strip()
from math import ceil
for _ in range(int(read())):
	(a, b) = map(int, read().split())
	print(ceil(abs(a - b) / 10))


test = int(input())
for i in range(0, test):
	ab = input().split()
	a = int(ab[0])
	b = int(ab[1])
	diff = abs(b - a)
	if diff > 0:
		val = int(diff % 10)
		if val > 0:
			val = 1
		else:
			val = 0
		val1 = int(diff / 10)
		ans = val1 + val
		print(ans)
	elif diff == 0:
		print('0')


def ev_od(a, b):
	if a == b:
		return 0
	if a > b:
		diff = a - b
		if diff % 2 == 0:
			return 1
		else:
			return 2
	if b > a:
		diff = b - a
		if diff % 2 == 0:
			return 2
		else:
			return 1
t = int(input())
for i in range(t):
	x = list(map(int, input().rstrip().split()))
	a = x[0]
	b = x[1]
	print(ev_od(a, b))


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	ba = b - a
	ab = a - b
	if a == b:
		print(0)
	elif a < b:
		print(ba // 10 + (0 if ba / 10 % 1 == 0 else 1))
	else:
		print(ab // 10 + (0 if ab / 10 % 1 == 0 else 1))


import math
T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	diff = max(a, b) - min(a, b)
	ans = math.ceil(diff / 10)
	print(ans)


t = int(input())
if t >= 1 and t <= 10000:

	def myfun(c):
		if c > 0 and c % 2 == 0:
			return 1
		elif c < 0 and c % 2 != 0:
			return 1
		elif c == 0:
			return 0
		else:
			return 2
	d = []
	for _ in range(t):
		(a, b) = input().split(' ')
		if (int(a) >= 1 and int(a) <= 1000000000) and (int(b) >= 1 and int(b) <= 1000000000):
			e = int(a) - int(b)
			p = myfun(e)
			d.append(p)
	for x in d:
		print(x)


t = int(input())
import math
for i in range(t):
	(m, n) = map(int, input().split())
	x = (max(m, n) - min(m, n)) / 10
	if math.ceil(x) == math.floor(x):
		print(int(x))
	else:
		print(int(x) + 1)


def func(a, b):
	s = 0
	x = a - b
	x //= 10
	s += x
	if (a - b) % 10:
		s += 1
	return s
n = int(input())
i = 0
while i < n:
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	print(func(a, b))
	i += 1


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	ans = []
	for _ in range(n):
		(a, b) = LI()
		if a == b:
			ans.append(0)
		elif a < b:
			x = b - a
			if x % 2 == 1:
				ans.append(1)
			else:
				ans.append(2)
		elif a > b:
			x = a - b
			if x % 2 == 0:
				ans.append(1)
			else:
				ans.append(2)
	for x in ans:
		print(x)
main()


n = int(input())
arr = []
for i in range(n):
	arr.append(list(map(int, input().split(' '))))
for i in range(len(arr)):
	prev = 0
	cur = arr[i]
	if cur[1] == cur[0]:
		print(0)
		continue
	start = min(cur[0], cur[1])
	end = max(cur[0], cur[1])
	count = 0
	while start != end:
		if start + 20 <= end:
			count = (end - start) // 20 * 2
			end = (end - start) % 20
			start = 0
		elif start + 10 <= end and prev != 10:
			count += 1
			start += 10
			prev = 10
		else:
			count += 1
			start = end
	print(count)


import sys, math
from collections import deque, defaultdict
import operator as op
from functools import reduce
sys.setrecursionlimit(10 ** 6)
I = sys.stdin.readline

def ii():
	return int(I().strip())

def li():
	return list(map(int, I().strip().split()))

def mi():
	return map(int, I().strip().split())

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def main():
	ans = ''
	for _ in range(ii()):
		(a, b) = mi()
		if a == b:
			ans += '0\n'
		else:
			x = abs(a - b)
			tmp = x // 10
			r = x % 10
			if r != 0:
				ans += str(tmp + 1) + '\n'
			else:
				ans += str(tmp) + '\n'
	print(ans)
main()


t = int(input())
data = []
for i in range(t):
	count = 0
	(a, b) = map(int, input().split())
	if a == b:
		data.append(count)
	elif b > a:
		d = b - a
		if d > 10:
			quo = d // 10
			rem = d % 10
			if rem == 0:
				count = count + quo
			else:
				count = count + quo + 1
			data.append(count)
		else:
			count = count + 1
			data.append(count)
	else:
		d = a - b
		if d > 10:
			quo = d // 10
			rem = d % 10
			if rem == 0:
				count = count + quo
			else:
				count = count + quo + 1
			data.append(count)
		else:
			count = count + 1
			data.append(count)
for var in data:
	print(var)


ntest_case = int(input())
output = []
for _ in range(ntest_case):
	abpair = [int(a) for a in input().split(' ')]
	if abpair[0] == abpair[1]:
		output.append(0)
	elif abpair[0] < abpair[1] or abpair[0] > abpair[1]:
		diff = abs(abpair[0] - abpair[1])
		if diff <= 10:
			output.append(1)
		else:
			moves = int(diff / 10)
			moves += 0 if diff % 10 == 0 else 1
			output.append(moves)
for i in output:
	print(i)


from sys import stdin
import math

def get_int():
	return int(stdin.readline())

def get_str():
	return stdin.readline().strip()

def get_ints():
	return map(int, stdin.readline().strip().split())

def get_array():
	return list(map(int, stdin.readline().strip().split()))

def get_array2d(row):
	return [list(map(int, stdin.readline().strip().split())) for _ in range(row)]
T = get_int()
for _ in range(T):
	(a, b) = get_ints()
	ans = math.ceil(abs(b - a) / 10)
	print(ans)


from collections import Counter
from collections import OrderedDict
from collections import defaultdict

def SOCountR(mylist):
	return OrderedDict(sorted(Counter(mylist).items(), reverse=True))

def SOCount(mylist):
	return OrderedDict(sorted(Counter(mylist).items()))

def freq_count(mylist):
	return Counter(mylist)
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	diff = abs(b - a)
	val = diff // 10
	if diff % 10 == 0:
		print(val)
	else:
		print(val + 1)


def solve(x, y):
	if x == y:
		return 0
	if x < y:
		(x, y) = (y, x)
	return int((x - y - 1) / 10) + 1
t = int(input())
for i in range(t):
	(x, y) = map(int, input().split(' '))
	print(solve(x, y))


def driver(x, y):
	if x > y:
		(x, y) = (y, x)
	if x == y:
		print(0)
		return
	z = y - x
	p = z // 10
	if z % 10 == 0:
		print(p)
	else:
		print(p + 1)

def main():
	for i in range(int(input())):
		(x, y) = map(int, input().split(' '))
		driver(x, y)
main()


import math
tc = int(input())
while tc > 0:
	(a, b) = [int(x) for x in input().split()]
	if a == b:
		print(0)
	else:
		print(math.ceil(abs(a - b) / 10))
	tc = tc - 1


def main():
	t = input()
	for i in range(0, int(t)):
		(a, b) = input().split()
		if a == b:
			print(0)
		else:
			diff = abs(int(a) - int(b))
			steps = int(diff / 10)
			if int(diff % 10) > 0:
				steps += 1
			print(steps)
main()


from math import *
from bisect import *
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
for _ in range(I()):
	(a, b) = M()
	c = abs(a - b)
	print(ceil(c / 10))


test_case = int(input())
for t in range(test_case):
	(n, m) = map(int, input().split())
	if n == m:
		print('0')
	elif n < m:
		if abs(n - m) % 2 == 0:
			print('2')
		else:
			print('1')
	elif abs(n - m) % 2 == 0:
		print('1')
	else:
		print('2')


T = int(input())
while T != 0:
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if a > b:
		if (a - b) % 10 == 0:
			print(int((a - b) / 10))
		else:
			print(int((a - b) / 10) + 1)
	elif (b - a) % 10 == 0:
		print(int((b - a) / 10))
	else:
		print(int((b - a) / 10) + 1)
	T -= 1


from math import log2, ceil
from heapq import heappush, heappop, heapify
from copy import deepcopy
from collections import deque, Counter as CC

def main():
	for t in range(int(input())):
		(a, b) = [int(j) for j in input().split()]
		print((abs(a - b) + 9) // 10)
main()


t = int(input())
for _ in range(t):
	(a, b) = [int(x) for x in input().split()]
	c = max(a, b) - min(a, b)
	l = [2, 1]
	if a == b:
		print('0')
	if a < b:
		print(l[c % 2])
	if a > b:
		print(l[not c % 2])


from math import *
count = int(0)
ans_list = list()
t = int(input())
inp_count = t
list_a = list()
list_b = list()
while inp_count != 0:
	(a, b) = input().split()
	list_a.append(int(a))
	list_b.append(int(b))
	inp_count -= 1
inp_count = t
i = int(0)
if i < len(list_a):
	while inp_count != 0:
		count = int(0)
		inp_count -= 1
		if int(list_a[i]) == int(list_b[i]):
			ans_list.append(count)
		elif int(list_a[i]) < int(list_b[i]):
			ans = int(list_b[i]) - int(list_a[i])
			ans = ceil(ans / 10)
			ans_list.append(ans)
		elif int(list_a[i]) > int(list_b[i]):
			ans = int(list_a[i]) - int(list_b[i])
			ans = ceil(ans / 10)
			ans_list.append(ans)
		i += 1
for item in ans_list:
	print(item)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	count = 0
	if n == m:
		count = 0
	elif n < m and (m - n) % 2 != 0:
		count = 1
	elif n < m and (m - n) % 2 == 0:
		count = 2
	elif n > m and (n - m) % 2 == 0:
		count = 1
	elif n > m and (n - m) % 2 != 0:
		count = 2
	print(count)


t = int(input().strip())
result = []
for i in range(t):
	x = input().strip().split()
	a = int(x[0])
	b = int(x[1])
	if a == b:
		result.append(0)
	elif a < b:
		if (b - a) % 2 == 1:
			result.append(1)
		else:
			result.append(2)
	elif (a - b) % 2 == 0:
		result.append(1)
	else:
		result.append(2)
for i in result:
	print(i)


for i in range(int(input())):
	b = list((int(x) for x in input().split()))
	if b[0] > b[1]:
		if abs(b[0] - b[1]) % 2 == 0:
			print(1)
		else:
			print(2)
	elif b[0] < b[1]:
		if abs(b[0] - b[1]) % 2 == 0:
			print(2)
		else:
			print(1)
	else:
		print(0)


from sys import stdin, stdout
import math
import re
import itertools
import collections
for _ in range(int(input())):
	(a, b) = map(int, input().rstrip().split())
	diff = abs(a - b)
	diff_mod_10 = diff % 10
	change = 0
	if diff_mod_10 == 0:
		pass
	else:
		change += 1
		diff = diff - diff_mod_10
	change += diff // 10
	print(change)


t = int(input())
for test in range(t):
	inps = input()
	(a, b) = tuple(list(map(int, inps.split())))
	if a == b:
		print('0')
	elif a < b:
		if a % 2 == 0 and b % 2 == 0 or (a % 2 == 1 and b % 2 == 1):
			print('2')
		else:
			print('1')
	elif a % 2 == 0 and b % 2 == 0 or (a % 2 == 1 and b % 2 == 1):
		print('1')
	else:
		print('2')


t = int(input())
for i in range(t):
	(x, y) = [int(x) for x in input().split()]
	z = abs(y - x)
	e = z % 10
	z = z // 10
	if e:
		z += 1
	ans = z
	print(ans)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = 0
	if b > a:
		while a < b:
			if a + 10 <= b:
				temp = b - a
				x = temp // 10
				a = a + x * 10
				c += x
			elif a + 9 <= b:
				a = a + 9
				c += 1
			elif a + 8 <= b:
				a = a + 8
				c += 1
			elif a + 7 <= b:
				a = a + 7
				c += 1
			elif a + 6 <= b:
				a = a + 6
				c += 1
			elif a + 5 <= b:
				a = a + 5
				c += 1
			elif a + 4 <= b:
				a = a + 4
				c += 1
			elif a + 3 <= b:
				a = a + 3
				c += 1
			elif a + 2 <= b:
				a = a + 2
				c += 1
			elif a + 1 <= b:
				a = a + 1
				c += 1
	else:
		while a > b:
			if a - 10 >= b:
				temp = a - b
				x = temp // 10
				a = a - x * 10
				c += x
			elif a - 9 >= b:
				a = a - 9
				c += 1
			elif a - 8 >= b:
				a = a - 8
				c += 1
			elif a - 7 >= b:
				a = a - 7
				c += 1
			elif a - 6 >= b:
				a = a - 6
				c += 1
			elif a - 5 >= b:
				a = a - 5
				c += 1
			elif a - 4 >= b:
				a = a - 4
				c += 1
			elif a - 3 >= b:
				a = a - 3
				c += 1
			elif a - 2 >= b:
				a = a - 2
				c += 1
			elif a - 1 >= b:
				a = a - 1
				c += 1
	print(c)


from collections import *
from sys import stdin, stderr

def rl():
	return [int(w) for w in stdin.readline().split()]
for _ in range(rl()[0]):
	(a, b) = rl()
	print((abs(a - b) - 1) // 10 + 1)


t = int(input())
count = 0
k = 0
m = 0
n = 0
for i in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		count = 0
		print(count)
	elif a > b:
		k = a - b
		m = k // 10
		n = k % 10
		if n == 0:
			count = m
		else:
			count = m + 1
		print(count)
	else:
		k = b - a
		m = k // 10
		n = k % 10
		if n == 0:
			count = m
		else:
			count = m + 1
		print(count)


from math import ceil
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	if d % 10 == 0:
		d //= 10
	else:
		d = ceil(d / 10)
	print(d)


import math
import sys
from collections import defaultdict, Counter
from itertools import groupby
rt = lambda : map(int, input().split())
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))

def main():
	t = ri()
	for _ in range(t):
		(a, b) = rt()
		res = 0
		if b > a:
			res = 1 if (b - a) % 2 == 1 else 2
		if b < a:
			res = 1 if (a - b) % 2 == 0 else 2
		print(res)
main()


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def line():
	return map(int, input().split())

def num():
	return int(input())
from itertools import repeat
t = num()
for _ in repeat(None, t):
	(a, b) = line()
	if a == b:
		print(0)
	elif a < b and (b - a) % 2 or (b < a and (not (a - b) % 2)):
		print(1)
	else:
		print(2)


from math import *
from cmath import *
from itertools import *
from decimal import *
from fractions import *
from sys import *
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n < k:
		(n, k) = (k, n)
	print((n - k) // 10 + ((n - k) % 10 != 0))


arr = [0] * 11
for i in range(1, 11):
	arr[i] = arr[i - 1] + i
T = int(input())
for _ in range(T):
	(a, b) = list(map(int, input().split()))
	if a > b:
		req = a - b
	else:
		req = b - a
	if req % 10 == 0:
		count = req // 10
	else:
		count = req // 10
		count += 1
	print(count)


T = int(input())
i = 1
while i <= T:
	lst = input().split()
	a = int(lst[0])
	b = int(lst[1])
	moves = 0
	while a != b:
		if b > a:
			if (b - a) % 2 == 1:
				a += b - a
			else:
				a += b - a - 1
		elif (a - b) % 2 == 0:
			a -= a - b
		else:
			a -= a - b - 2
		moves += 1
	print(moves)
	i += 1


from collections import Counter
from math import log, e, inf
t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split(' '))
	s = 0
	x = max(a, b)
	y = min(a, b)
	x = x - y
	s = x // 10
	x = x % 10
	if x > 0:
		s += 1
	print(s)


def chislo(a, b, count):
	if a > b:
		(a, b) = (b, a)
	if a < b:
		count += (b - a) // 10
		if (b - a) % 10 in range(1, 10):
			count += 1
			return count
		else:
			return count
	else:
		return count
_list = []
n = int(input())
for i in range(0, n):
	(a, b) = input().split(' ', 1)
	count = 0
	_list.append(chislo(int(a), int(b), count))
for i in _list:
	print(i)


import sys
INP = lambda : sys.stdin.readline().strip()
INT = lambda : int(INP())
MAP = lambda : map(int, INP().split())
ARR = lambda : [int(i) for i in INP().split()]

def JOIN(arr, x=' '):
	return x.join([str(i) for i in arr])

def EXIT(x='NO'):
	print(x)
	exit()
from math import ceil
for _ in range(INT()):
	(a, b) = MAP()
	print(ceil(abs(b - a) / 10))


x = int(input())
for i in range(x):
	k = list(map(int, input().split()))
	k.sort()
	print((k[1] - k[0]) // 10 + 1) if (k[1] - k[0]) % 10 != 0 else print((k[1] - k[0]) // 10)


def main():
	T = int(input())
	for i in range(T):
		(a, b) = list(map(int, input().split()))
		if b < a:
			(a, b) = (b, a)
		cnt = (b - a) // 10
		if not (b - a) % 10:
			print(cnt)
		else:
			print(cnt + 1)
main()


n = int(input())
for _ in range(n):
	count = 0
	(a, b) = [int(x) for x in input().split()]
	while a != b:
		if a == b:
			break
		elif a < b:
			c = b - a
			if c % 2 == 1:
				a = a + c
			else:
				a = a + (c - 1)
			count += 1
		else:
			count += 1
			c = a - b
			if c % 2 == 0:
				a = a - c
			else:
				a = a - (c + 1)
	print(count)


b = int(input())
a = []
for i in range(b):
	li = list(map(int, input().split()))
	if li[0] == li[1]:
		a.append(0)
	elif li[0] < li[1] and (li[0] + li[1]) % 2 == 0 and (li[0] % 2 != 0):
		a.append(2)
	elif li[0] < li[1] and (li[0] + li[1]) % 2 != 0 and (li[0] % 2 != 0):
		a.append(1)
	elif li[0] > li[1] and (li[0] + li[1]) % 2 == 0 and (li[0] % 2 != 0):
		a.append(1)
	elif li[0] > li[1] and (li[0] + li[1]) % 2 != 0 and (li[0] % 2 != 0):
		a.append(2)
	elif li[0] < li[1] and (li[0] + li[1]) % 2 == 0 and (li[0] % 2 == 0):
		a.append(2)
	elif li[0] < li[1] and (li[0] + li[1]) % 2 != 0 and (li[0] % 2 == 0):
		a.append(1)
	elif li[0] > li[1] and (li[0] + li[1]) % 2 == 0 and (li[0] % 2 == 0):
		a.append(1)
	elif li[0] > li[1] and (li[0] + li[1]) % 2 != 0 and (li[0] % 2 == 0):
		a.append(2)
for i in a:
	print(i)


def create_cases(data1, data2):
	cases = []
	answers = []
	data1 = data1.split('\n')
	data2 = data2.split('\n')
	for i in data1:
		x = list(map(int, i.split()))
		x.sort()
		cases.append(x)
	for i in data2:
		answers.append(i.strip())
	answers = list(map(int, answers))
	return (cases, answers)

def f(cases):
	answers = []
	for case in cases:
		n = 0
		x = case[1] - case[0]
		for i in range(10, 0, -1):
			if x == 0:
				break
			n += x // i
			x = x % i
		answers.append(n)
	return [_ for _ in answers]
n = int(input())
cases = []
for _ in range(n):
	x = list(map(int, input().split()))
	x.sort()
	cases.append(x)
answers = f(cases)
for i in answers:
	print(i)


test_case = int(input())
for i in range(test_case):
	values = list(map(int, input().split(' ')))
	if values[0] == values[1]:
		print(0)
	elif values[0] < values[1]:
		if abs(values[0] - values[1]) % 2 == 1:
			print(1)
		else:
			print(2)
	elif abs(values[0] - values[1]) % 2 == 1:
		print(2)
	else:
		print(1)


import math
n = int(input())
imp = []
for i in range(n):
	(a, b) = map(int, input().split(' '))
	imp.append([a, b])

def find(x):
	count = 0
	if x == 0:
		return 0
	count = math.ceil(x / 10)
	return count
for x in imp:
	a = x[0]
	b = x[1]
	if a > b:
		diff = a - b
		print(find(diff))
	else:
		diff = b - a
		print(find(diff))


import math, sys, os, collections, functools
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
for testcase in range(int(input())):
	(a, b) = map(int, input().split())
	x = 1
	if (b - a) % 10 == 0:
		x = 0
	print(abs(b - a) // 10 + x)


import math
t = int(input())
for i in range(t):
	arr = [int(x) for x in input().split()]
	(a, b) = (arr[0], arr[1])
	d = abs(a - b)
	if d % 10:
		print(d // 10 + 1)
	else:
		print(d // 10)


def abs(x):
	if x > 0:
		return x
	return -x
t = int(input())
for i in range(t):
	string = input()
	list1 = string.split()
	A = [int(i) for i in list1]
	print((abs(A[1] - A[0]) - 1) // 10 + 1)


from math import *
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	ans = abs(a - b)
	if ans > 10:
		print(ceil(ans / 10))
	elif a == b:
		print(0)
	else:
		print(1)


results = []
for i in range(0, int(input())):
	(a, b) = input().split()
	result = 0
	a = int(a)
	b = int(b)
	if a == b:
		result = 0
	elif a < b:
		if a % 2 == 0:
			if b % 2 == 0:
				result = 2
			else:
				result = 1
		elif b % 2 == 0:
			result = 1
		else:
			result = 2
	elif a > b:
		if a % 2 == 0:
			if b % 2 == 0:
				result = 1
			else:
				result = 2
		elif b % 2 == 0:
			result = 2
		else:
			result = 1
	results.append(result)
for i in results:
	print(i)


t = int(input())
for i in range(0, t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a > b:
		p = a - b
		if p <= 10:
			print(1)
		else:
			v = p // 10
			w = p % 10
			if w == 0:
				print(v)
			else:
				print(v + 1)
	else:
		q = b - a
		if q <= 10:
			print(1)
		else:
			y = q // 10
			m = q % 10
			if m == 0:
				print(y)
			else:
				print(y + 1)


import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque

def r():
	return int(input())

def rm():
	return map(int, input().split())

def rl():
	return list(map(int, input().split()))
for _ in range(r()):
	(a, b) = rm()
	print(math.ceil(abs(a - b) / 10))


for _ in range(int(input())):
	(a, b) = [int(__) for __ in input().split()]
	diff = abs(a - b)
	l1 = list(range(1, 11))[::-1]
	ans = 0
	for i in l1:
		if diff >= i:
			ans += diff // i
			diff %= i
	print(ans)


t = int(input())
for i in range(t):
	(a, b) = (int(x) for x in input().split())
	if a < b:
		tmp = a
		a = b
		b = tmp
	dif = (a - b) // 10
	if (a - b) % 10:
		dif = dif + 1
	print(dif)


lineNumsInput = input()
lineNums = int(lineNumsInput)
inputList = []
for number in range(lineNums):
	inputList.append(input())
for num in inputList:
	print('\n')
	numList = num.split()
	for i in range(len(numList)):
		numList[i] = int(numList[i])
	maxNum = int(max(numList))
	minNum = int(min(numList))
	count = int(maxNum - minNum) // 10 + ((maxNum - minNum) % 10 != 0)
	print(count)


p = []
n = int(input())
for i in range(n):
	l = list(map(int, input().split()))
	(a, b) = (l[0], l[1])
	if a - b == 0:
		p.append(0)
	elif a > b:
		if (a - b) % 2 == 1:
			p.append(2)
		else:
			p.append(1)
	elif (a - b) % 2 == 0:
		p.append(2)
	else:
		p.append(1)
for j in p:
	print(j)


n = int(input())
ans = []
for _ in range(n):
	(a, b) = map(int, input().split())
	(x, y) = divmod(abs(b - a), 10)
	ans.append(x + 1 if y != 0 else x)
print('\n'.join(map(str, ans)))


import sys
t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	ans = abs(a - b) // 10
	if abs(a - b) % 10 != 0:
		ans += 1
	print(ans)


for i in range(int(input())):
	(a, b) = [int(o) for o in input().split()]
	(n, c) = (abs(b - a), 0)
	if n >= 10:
		c += n // 10
		n = n % 10
	if n >= 9:
		c += n // 9
		n = n % 9
	if n >= 8:
		c += n // 8
		n = n % 8
	if n >= 7:
		c += n // 7
		n = n % 7
	if n >= 6:
		c += n // 6
		n = n % 6
	if n >= 5:
		c += n // 5
		n = n % 5
	if n >= 4:
		c += n // 4
		n = n % 4
	if n >= 3:
		c += n // 3
		n = n % 3
	if n >= 2:
		c += n // 2
		n = n % 2
	if n >= 1:
		c += n // 1
		n = n % 1
	if n == 0:
		print(c)


t = int(input())
for ini in range(t):
	(a, b) = list(map(int, input().split(' ')))
	delta = abs(a - b)
	moves = 0
	if delta == 0:
		moves = 0
	elif delta <= 10:
		moves = 1
	else:
		moves = delta // 10
		if delta % 10 != 0:
			moves += 1
	print(moves)


n = int(input())
for i in range(n):
	s = input().split(' ')
	if (int(s[1]) - int(s[0])) % 2 == 0 and int(s[0]) > int(s[1]) or ((int(s[1]) - int(s[0])) % 2 != 0 and int(s[1]) > int(s[0])):
		print(1)
	elif int(s[0]) == int(s[1]):
		print(0)
	else:
		print(2)


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


n = int(input())
for i in range(n):
	j = input()
	arr = j.split()
	for i in range(2):
		arr[i] = int(arr[i])
	a = arr[0]
	b = arr[1]
	ext = a - b
	if ext < 0:
		if ext % 2 == 0:
			print(2)
		else:
			print(1)
	elif ext > 0:
		if ext % 2 == 0:
			print(1)
		else:
			print(2)
	else:
		print(0)


T = int(input())
res = list()
for i in range(T):
	x = list(map(int, input().split()))
	res.append(x)
for i in range(len(res)):
	diff = abs(res[i][1] - res[i][0])
	count = diff // 10
	m = diff % 10
	if m > 0:
		count += 1
	print(count)


quantity = int(input())
array = []
for i in range(quantity):
	pair = input().split()
	mod = (int(pair[0]) - int(pair[1])) % 2
	if int(pair[0]) > int(pair[1]):
		sign = 1
	elif int(pair[0]) < int(pair[1]):
		sign = -1
	else:
		sign = 0
	pair = (mod, sign)
	array.append(pair)
for i in range(quantity):
	if array[i][0] == 1 and array[i][1] == 1 or (array[i][0] == 0 and array[i][1] == -1):
		print('2')
	elif array[i][0] == 1 and array[i][1] == -1 or (array[i][0] == 0 and array[i][1] == 1):
		print('1')
	else:
		print('0')


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


try:
	t = int(input())
	for i in range(t):
		x = list(map(int, input().split()))
		a = x[0]
		b = x[1]
		c = 0
		if a == b:
			print(0)
		if a < b:
			c = b - a
			if (b - a) % 2 == 0:
				print(2)
			else:
				print(1)
		if a > b:
			c = a - b
			if (a - b) % 2 == 0:
				print(1)
			else:
				print(2)
except:
	pass


import sys
ii = lambda : sys.stdin.readline().strip()
idata = lambda : [int(x) for x in ii().split()]

def solve():
	(a, b) = idata()
	print((abs(a - b) + 9) // 10)
	return
for t in range(int(ii())):
	solve()


from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	T = int(input())
	for _ in [0] * T:
		(A, B) = map(int, input().split())
		d = abs(B - A)
		ans = (d + 9) // 10
		print(ans)
main()


n = int(input())
num = []
for _ in range(n):
	s = [int(i) for i in input().split()]
	num.append(abs(s[0] - s[1]))
for i in range(n):
	ip = num[i]
	if ip == 0:
		print(0)
	else:
		count = 0
		if ip >= 10:
			c = ip // 10
			if ip % 10 == 0:
				count = count + c
			else:
				count = count + c + 1
		else:
			count = 1
		print(count)


import sys
input = sys.stdin.readline
INF = float('inf')
tc = int(input())
for _ in range(tc):
	(a, b) = map(int, input().split())
	ans = abs(b - a) // 10 if abs(b - a) % 10 == 0 else abs(b - a) // 10 + 1
	print(ans)


import os
import sys
debug = True
if debug and os.path.exists('input.in'):
	input = open('input.in', 'r').readline
else:
	debug = False
	input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
test_count = inp()
for t in range(test_count):
	if debug:
		print('Test Case #', t + 1)
	(a, b) = invr()
	d = abs(a - b)
	print(d // 10 + (1 if d % 10 > 0 else 0))


z = int(input())
for y in range(z):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	if c % 10 == 0:
		print(int(c / 10))
	else:
		print(int(c // 10 + 1))


from collections import defaultdict as dc
from collections import Counter
import sys
import math
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	print(x // 10 + min(x % 10, 1))


def solve(n):
	if n % 10 == 0:
		return n // 10
	return n // 10 + 1
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	if a > b:
		x = a - b
		print(solve(x))
	elif a < b:
		x = b - a
		print(solve(x))


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	ctr = 0
	k = abs(b - a)
	if k == 0:
		print(0)
	elif k % 10 == 0:
		print(k // 10)
	else:
		print(k // 10 + 1)


n = int(input())
for t in range(n):
	(a, b) = list(map(int, input().split()))
	c = abs(a - b)
	i = 0
	if c % 10 != 0:
		i = 1
	d = c // 10 + i
	print(d)


MOD = 1000000007
from collections import defaultdict as dd, Counter, deque

def si():
	return input()

def ii():
	return int(input())

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

def mi():
	return map(int, input().split())

def out(v):
	print(v)

def spout():
	print(v, end=' ')

def d2b(n):
	return bin(n).replace('0b', '')

def twod(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def vow():
	return ['a', 'e', 'i', 'o', 'u']

def let():
	return [chr(i) for i in range(97, 123)]

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ispow2(x):
	return x and (not x & x - 1)

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)
t = ii()
while t:
	t -= 1
	(a, b) = mi()
	(a, b) = (max(a, b), min(a, b))
	if a == b:
		print(0)
	else:
		d = a - b
		if d % 10 == 0:
			print(d // 10)
		else:
			print(d // 10 + 1)


def fun(a, b):
	if a == b:
		return 0
	if b > a:
		diff = b - a
		if diff % 2 != 0:
			return 1
		else:
			return 2
	else:
		diff = a - b
		if diff % 2 == 0:
			return 1
		else:
			return 2
testcase = int(input())
for i in range(testcase):
	(a, b) = map(int, input().split())
	print(fun(a, b))


t = int(input())
while t:
	t -= 1
	z = list(map(int, input().split()))
	(a, b) = (z[0], z[1])
	count = 0
	start = 1
	end = 10
	while a != b:
		if a < b:
			if b - a >= 10:
				x = (b - a) // 10
				count += x
				a += 10 * x
			else:
				a += b - a
				count += 1
		elif b - a <= -10:
			x = (a - b) // 10
			count += x
			a -= 10 * x
		else:
			a += b - a
			count += 1
	print(count)


from sys import *
from math import ceil
ws = lambda : map(int, stdin.readline().strip().split())
li = lambda : list(map(int, stdin.readline().strip().split()))
mod = 1000000007

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

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

def prod(l):
	ans = 1
	for i in range(len(l)):
		ans = ans * l[i]
	return ans

def sortindex(l, a):
	c = []
	if a == -1:
		rev = True
	else:
		rev = False
	for i in range(len(l)):
		c.append([l[i], i])
	x = sorted(c, reverse=rev)
	print(x)
	c = []
	for i in range(len(l)):
		c.append(x[i][1])
	return c
for testcases in range(int(input())):
	(a, b) = ws()
	if a == b:
		print(0)
		continue
	if a > b:
		temp = a - b
	else:
		temp = b - a
	print(ceil(temp / 10))


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


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


from collections import Counter
from math import ceil
a = ord('a')
alph = [chr(i) for i in range(a, a + 26)]
li = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
for _ in range(int(input())):
	(a, b) = list(map(int, input().strip().split()))
	print(ceil(abs(a - b) / 10))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if b > a:
		(a, b) = (b, a)
	d = a - b
	out = d // 10
	d %= 10
	if d > 0:
		out += 1
	print(out)


import sys
from collections import defaultdict
name = sys.stdin.read()
jobGrid = []
isJob = True
row = []
grid = name.split('\n')
grid = grid[:-1]
number_of_cases = int(grid[0])
for i in range(1, number_of_cases + 1):
	case = [int(x) for x in grid[i].split(' ')]
	diff = abs(case[0] - case[1])
	ans = diff // 10
	if diff % 10 != 0:
		ans += 1
	print(ans)


for i in range(int(input())):
	(a, b) = tuple(map(int, input().split()))
	(b, a) = (max(b, a), min(b, a))
	if (b - a) % 10 != 0:
		print(abs((b - a) // 10 + 1))
	else:
		print(abs((b - a) // 10))


import math
for ad in range(int(input())):
	(a, b) = list(map(int, input().split()))
	x = math.ceil(abs(a - b) / 10)
	print(x)


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split(' ')]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n').split(' ')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	(a, b) = li()
	if a == b:
		print(0)
		continue
	if a > b:
		if a - b & 1:
			print(2)
		else:
			print(1)
	elif b - a & 1:
		print(1)
	else:
		print(2)


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for tt in range(int(input())):
	(a, b) = map(int, input().split())
	diff = b - a
	if diff > 0 and diff % 2 == 0:
		print(2)
	elif diff > 0 and diff % 2 == 1:
		print(1)
	elif diff < 0 and diff % 2 == 0:
		print(1)
	elif diff < 0 and diff % 2 == 1:
		print(2)
	else:
		print(0)


from sys import stdin

def solve(tc):
	(a, b) = map(int, stdin.readline().split())
	cnt = 0
	if a < b:
		if (b - a) % 2:
			cnt = 1
		else:
			cnt = 2
	elif a > b:
		if (a - b) % 2:
			cnt = 2
		else:
			cnt = 1
	print(cnt)
	pass
LOCAL_TEST = not __debug__
if LOCAL_TEST:
	infile = __file__.split('.')[0] + '-test.in'
	stdin = open(infile, 'r')
tcs = int(stdin.readline().strip())
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


def solve(a, b, ans):
	if a == b:
		ans.append(0)
	elif a < b:
		diff = b - a
		if diff % 2 == 0:
			ans.append(2)
		else:
			ans.append(1)
	else:
		diff = a - b
		if diff % 2 != 0:
			ans.append(2)
		else:
			ans.append(1)

def main():
	ans = []
	t = int(input())
	for i in range(t):
		(a, b) = map(int, input().split())
		solve(a, b, ans)
	for i in ans:
		print(i)
main()


import math as m
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	s = abs(b - a)
	print(m.ceil(s / 10))


from sys import stdin

def inp():
	return next((ss.rstrip() for ss in stdin))

def itg():
	return int(inp())

def mpint():
	return map(int, inp().split())
for case in range(itg()):
	(a, b) = mpint()
	if a == b:
		print(0)
		continue
	c = b - a
	if c > 0:
		print(1 if c & 1 else 2)
	else:
		print(2 if -c & 1 else 1)


def func(a, b):
	target = abs(b - a)
	if target is 0:
		return 0
	if target < 11:
		return 1
	if target % 10 is 0:
		return target // 10
	current = target // 10
	return current + 1
t = int(input())
while t > 0:
	x = list(map(int, input().strip().split(' ')))
	(a, b) = (x[0], x[1])
	print(func(a, b))
	t -= 1


def read_int():
	return int(input().strip())

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

def read_string():
	return input()

def read_strings():
	return input().strip().split()

def swap(x, y):
	return (y, x)

def solve():
	(a, b) = read_ints()
	if a > b:
		(a, b) = swap(a, b)
	diff = b - a
	if diff % 10 > 0:
		add = 1
	else:
		add = 0
	print(diff // 10 + add)

def read_input():
	t = read_int()
	for _ in range(t):
		solve()
read_input()


t = int(input())
rpta = []
index = 0
temp = 0
for i in range(t):
	main = list(map(int, input().split()))
	if main[0] == main[1]:
		rpta.append(0)
	else:
		while main[0] != main[1]:
			index = index + 1
			if main[0] > main[1]:
				if (main[0] - main[1]) % 2 == 0:
					main[0] = main[1]
				else:
					main[0] = main[0] - (main[0] - main[1] + 1)
			elif main[0] < main[1]:
				if (main[1] - main[0]) % 2 != 0:
					main[0] = main[1]
				else:
					main[0] = main[1] - (main[1] - main[0] - 1)
		rpta.append(index)
		index = 0
for j in rpta:
	print(j)


import math
x = int(input())
for i in range(0, x):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	print(math.ceil(abs(a - b) / 10))


t = int(input())
while t > 0:
	t = t - 1
	(n, m) = map(int, input().split())
	l = max(n, m)
	p = min(n, m)
	x = l - p
	x = x / 10
	if x.is_integer():
		print(int(x))
	else:
		print(int(x) + 1)


t = int(input())
L = []

def fonction(a, b):
	if a == b:
		return 0
	elif b > a:
		if (b - a) % 2 == 0:
			return 2
		else:
			return 1
	elif (a - b) % 2 == 0:
		return 1
	else:
		return 2
for i in range(t):
	(a, b) = [int(x) for x in input().split()]
	L.append(fonction(a, b))
for k in L:
	print(k)


from collections import defaultdict
import sys, math
f = None
try:
	f = open('q1.input', 'r')
except IOError:
	f = sys.stdin
if 'xrange' in dir(__builtins__):
	range = xrange

def print_case_iterable(case_num, iterable):
	print('Case #{}: {}'.format(case_num, ' '.join(map(str, iterable))))

def print_case_number(case_num, iterable):
	print('Case #{}: {}'.format(case_num, iterable))

def print_iterable(A):
	print(' '.join(A))

def read_int():
	return int(f.readline().strip())

def read_int_array():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def read_string():
	return list(f.readline().strip())

def bi(x):
	return bin(x)[2:]

def solution(a, b):
	if b == a:
		return 0
	if b > a and (b - a) % 2 == 1:
		return 1
	if b < a and (b - a) % 2 == 0:
		return 1
	return 2

def main():
	T = read_int()
	for i in range(T):
		(a, b) = read_int_array()
		x = solution(a, b)
		if 'xrange' not in dir(__builtins__):
			print(x)
		else:
			(print >> output, str(x))
	if 'xrange' in dir(__builtins__):
		print(output.getvalue())
		output.close()
if 'xrange' in dir(__builtins__):
	import cStringIO
	output = cStringIO.StringIO()
main()


def ooo(a, b):
	if b < a:
		(a, b) = (b, a)
	c = b - a
	if c % 10 == 0:
		return c // 10
	return int(c // 10 + 1)
t = int(input())
r = []
for i in range(t):
	x = [int(i) for i in input().split()]
	print(ooo(x[0], x[1]))


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	print((diff + 10 - 1) // 10)


import math
for _ in range(int(input())):
	s = input().split()
	d = abs(int(s[0]) - int(s[1]))
	print(math.ceil(d / 10))


def read_ints():
	return map(int, input().split(' '))
t = int(input())
for i in range(t):
	(a, b) = read_ints()
	distancia = abs(a - b)
	vezes = distancia // 10
	if distancia % 10 != 0:
		vezes += 1
	print(vezes)


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


import sys
import math
import bisect

def solve(a, b):
	if b == a:
		return 0
	if b > a:
		if (b - a) % 2 == 1:
			return 1
		else:
			return 2
	elif (a - b) % 2 == 0:
		return 1
	else:
		return 2

def main():
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		print(solve(a, b))
main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math
from collections import Counter, defaultdict, deque

def int1():
	return int(input())

def map1():
	return map(int, input().split())

def list1():
	return list(map(int, input().split()))
mod = pow(10, 9) + 7

def solve():
	(a, b) = map1()
	x = abs(a - b)
	v = math.ceil(x / 10)
	print(v)
for _ in range(int(input())):
	solve()


t = int(input())
i = 1
while i <= t:
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	tens = diff // 10
	if diff % 10 == 0:
		print(tens)
	else:
		print(tens + 1)
	i += 1


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	d = abs(b - a)
	move = 0
	if d / 10 > 0:
		move = move + d // 10
		d = d % 10
	if d / 9 > 0:
		move = move + d // 9
		d = d % 9
	if d / 8 > 0:
		move = move + d // 8
		d = d % 8
	if d / 7 > 0:
		move = move + d // 7
		d = d % 7
	if d / 6 > 0:
		move = move + d // 6
		d = d % 6
	if d / 5 > 0:
		move = move + d // 5
		d = d % 5
	if d / 4 > 0:
		move = move + d // 4
		d = d % 4
	if d / 3 > 0:
		move = move + d // 3
		d = d % 3
	if d / 2 > 0:
		move = move + d // 2
		d = d % 2
	if d / 1 > 0:
		move = move + d // 1
		d = d % 1
	print(move)


test = int(input())
for i in range(0, test):
	(a, b) = map(int, input().split())
	temp = b - a
	if a == b:
		ans = 0
	elif temp > 0 and temp % 2 == 0:
		ans = 2
	elif temp > 0 and temp % 2 == 1:
		ans = 1
	else:
		t = abs(temp)
		if t % 2 == 0:
			ans = 1
		else:
			ans = 2
	print(ans)


t = int(input())
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	diff = b - a
	if diff == 0:
		print('0')
	elif diff > 0:
		r = int(diff % 2)
		if r != 0:
			print('1')
		else:
			print('2')
	else:
		r = int(abs(diff) % 2)
		if r == 0:
			print('1')
		else:
			print('2')


def solve(a, b):
	if a == b:
		return 0
	p = b - a
	if p % 10 == 0:
		return p // 10
	return p // 10 + 1
for _ in range(int(input())):
	(a, b) = sorted(map(int, input().split()))
	print(solve(a, b))


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()


t = int(input())

def step(a, b):
	if a == b:
		return 0
	if a < b:
		return 2 - (a - b) % 2
	return 1 + (a - b) % 2
for _ in range(t):
	(a, b) = map(int, input().split())
	print(step(a, b))


def solve(a, b):
	if a == b:
		return 0
	if b < a:
		return solve(a=b, b=a)
	d = b - a
	ans = d // 10
	if d % 10 != 0:
		ans += 1
	return ans
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	print(solve(a, b))


def min_moves(a, b):
	n = abs(a - b)
	if n % 10 > 0:
		print(n // 10 + 1)
	else:
		print(n // 10)
x = input()
for i in range(int(x)):
	values = input().split(' ')
	min_moves(int(values[0]), int(values[1]))


t_case = int(input())
for _ in range(t_case):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	moves = diff // 10
	if diff % 10:
		moves += 1
	print(moves)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	s = max(a, b)
	b = min(a, b)
	if (s - b) % 10 == 0:
		print((s - b) // 10)
	else:
		print((s - b) // 10 + 1)


def solve():
	(a, b) = map(int, input().split())
	if a == b:
		return 0
	if a > b:
		diff = a - b
	diff = abs(a - b)
	if diff <= 10:
		return 1
	moves = 0
	p = diff // 10
	moves += p
	if diff % 10 != 0:
		moves += 1
	return moves
for _ in range(int(input())):
	print(solve())


tc = int(input())
for i in range(tc):
	(a, b) = map(int, input().split())
	if a == b:
		print('0')
		continue
	if a < b:
		d = b - a
		if d % 2 == 1:
			print('1')
		else:
			print('2')
	else:
		d = a - b
		if d % 2 == 0:
			print('1')
		else:
			print('2')


def cnt(a, d):
	count = 0
	if d - a < 10:
		count += 1
	elif d - a > 10:
		c = (d - a) // 10
		if (d - a) % 10 == 0:
			count += c
		else:
			count += c + 1
	return count
b = int(input())
for i in range(0, b):
	(p, q) = input().split()
	p = int(p)
	q = int(q)
	if p - q == 10 or q - p == 10:
		print(1)
	elif p < q:
		print(cnt(p, q))
	elif p > q:
		p = p * -1
		q = q * -1
		print(cnt(p, q))
	elif p == q:
		print(0)


t = int(input())
res = []
for i in range(t):
	(m, n) = map(int, input().split())

	def solve(m, n, ct):
		if m == n:
			return ct
		else:
			if n >= m:
				num = n - m
			if n < m:
				num = m - n
			rem = num % 10
			q = num // 10
			if num <= 10:
				ct += 1
			elif num > 10:
				ct += q
				if rem != 0:
					ct += 1
			return ct
	res.append(solve(m, n, 0))
for _ in range(t):
	print(res[_])


import sys

def calc(a, b):
	if a > b:
		c = (a - b) // 10 + (0 if (a - b) % 10 == 0 else 1)
	elif a == b:
		c = 0
	else:
		c = (b - a) // 10 + (0 if (b - a) % 10 == 0 else 1)
	return c
t = int(input())
for x in range(0, t):
	(a, b) = map(int, input().split())
	c = calc(a, b)
	print(c)


N = int(input())
for i in range(N):
	data = input()
	split = data.split(' ')
	a = int(split[0])
	b = int(split[1])
	if a == b:
		print(0)
	elif a > b and (a - b) % 2 == 0:
		print(1)
	elif a < b and (b - a) % 2 == 1:
		print(1)
	elif a > b and (a - b) % 2 == 1:
		print(2)
	elif a < b and (b - a) % 2 == 0:
		print(2)


def findways(inputNum):
	x = inputNum[0]
	y = inputNum[1]
	answer = 0
	numInt = abs(x - y)
	if numInt == 0:
		answer = 0
	elif numInt <= 10:
		answer = 1
	elif numInt % 10 == 0:
		answer = int(numInt / 10)
	else:
		answer = int(numInt / 10) + 1
	return answer
num = int(input())
noOfways = 0
for i in range(num):
	a = []
	a = list(map(int, input().strip().split()))[:2]
	noOfways = findways(a)
	print(noOfways)


data = input().rstrip().split()
n = int(data[0])
aa = []
bb = []
for i in range(n):
	data = input().rstrip().split()
	(a, b) = (int(data[0]), int(data[1]))
	aa.append(a)
	bb.append(b)
for (a, b) in zip(aa, bb):
	if a == b:
		print(0)
	elif a % 2 == b % 2 and a < b or (a % 2 != b % 2 and a > b):
		print(2)
	else:
		print(1)


a = int(input())
for i in range(a):
	cnt = 0
	d = 0
	(b, c) = map(int, input().split())
	if b > c:
		g = b - c
		if g % 2 == 0:
			cnt += 1
			print(cnt)
		else:
			cnt += 1
			print(cnt + 1)
	elif c > b:
		f = c - b
		if f % 2 == 0:
			d += 1
			print(d + 1)
		else:
			d += 1
			print(d)
	else:
		print('0')


t = int(input())
while t:
	(a, b) = list(map(int, input().split()))
	if a > b:
		(a, b) = (b, a)
	count = b // 10 - a // 10
	temp = a + 10 * count
	if temp >= b:
		print(count)
	else:
		print(count + 1)
	t -= 1


import math
t = int(input(''))
for i in range(t):
	(a, b) = map(int, input('').split())
	if a == b:
		print(0)
	elif a > b:
		rem = (a - b) / 10
		ans = math.ceil(rem)
		print(ans)
	else:
		rem1 = (b - a) / 10
		ans1 = math.ceil(rem1)
		print(ans1)


def inp():
	return int(input())

def inl():
	return [int(i) for i in input().split()]
t = inp()
for _ in range(t):
	(a, b) = inl()
	d = abs(b - a)
	if d % 10 == 0:
		print(d // 10)
	else:
		print(d // 10 + 1)


t = int(input())
l = []
while t != 0:
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if abs(b - a) == 0:
		print(0)
	elif abs(b - a) % 10 == 0:
		print(abs(b - a) // 10)
	else:
		print(abs(b - a) // 10 + 1)
	t -= 1


n = int(input())
list_ans = []
for i in range(n):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	ans = (c - 1) // 10 + 1
	list_ans.append(ans)
for item in list_ans:
	print(item)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	if a > b:
		num = (a - b) // 10
		if (a - b) % 10 == 0:
			print(num)
		else:
			print(num + 1)
		continue
	else:
		num = (b - a) // 10
		if (b - a) % 10 == 0:
			print(num)
		else:
			print(num + 1)
		continue


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	r = abs(a - b)
	k = 0
	r = list(str(r))
	for j in range(len(r) - 1):
		k += int(r[j]) * 10 ** (len(r) - j - 2)
	if r[len(r) - 1] != '0':
		print(k + 1)
	else:
		print(k)


t = int(input())
s = []
for i in range(t):
	(a, b) = map(int, input().split(' '))
	diff = a - b
	s.append(abs(diff))
for i in range(t):
	k = s[i]
	if k == 0:
		print(0)
	else:
		c = 0
		if k >= 10:
			val = k // 10
			if k % 10 == 0:
				c = c + val
			else:
				c = c + val + 1
		else:
			c = 1
		print(c)


from collections import defaultdict as dd
from collections import Counter as ccd
from itertools import permutations as pp
from itertools import combinations as cc
from random import randint as rd
from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq as hq
import math
mod = pow(10, 9) + 7

def inp(flag=0):
	if flag == 0:
		return list(map(int, input().strip().split(' ')))
	else:
		return int(input())
t = inp(1)
while t:
	t -= 1
	(a, b) = inp()
	if a == b:
		print(0)
	elif a % 2 == b % 2:
		if a < b:
			print(2)
		else:
			print(1)
	elif a < b:
		print(1)
	else:
		print(2)


from sys import stdin

def inp():
	return stdin.buffer.readline().rstrip().decode('utf8')

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())
for __ in range(itg()):
	(a, b) = mpint()
	(q, r) = divmod(abs(a - b), 10)
	print(q if r == 0 else q + 1)


from math import ceil
t = int(input())
for _ in range(t):
	(a, b) = (int(i) for i in input().split(' '))
	res = ceil(abs(b - a) / 10)
	print(res)


import math
for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = max(a, b)
	d = min(a, b)
	f = c - d
	print(math.ceil(f / 10))


def integer(a, b):
	if a == b:
		return 0
	if a > b:
		temp = a - b
	else:
		temp = b - a
	one = temp % 10
	two = temp // 10
	if one == 0:
		return two
	else:
		return two + 1
t = int(input())
for i in range(t):
	arr = list(map(int, input().strip().split()))
	print(integer(arr[0], arr[1]))


t = int(input())

def fun(a, b):
	diff = abs(b - a)
	if diff <= 10:
		if diff == 0:
			return 0
		else:
			return 1
	elif diff % 10 == 0:
		return diff // 10
	else:
		return diff // 10 + 1
for i in range(t):
	(a, b) = list(map(int, input().split()))
	print(fun(a, b))


import math
test = int(input())
while test > 0:
	test -= 1
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	print(math.ceil(diff / 10))


import math

def odd(a, b):
	f = abs(a - b)
	sum = 0
	p = 0
	if f % 2 == 0:
		if a < b:
			return 2
		else:
			return 1
	elif a > b:
		return 2
	else:
		return 1
t = int(input())
while t > 0:
	sum = 0
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		print(odd(a, b))
	t -= 1


t = int(input())
for test in range(t):
	(a, b) = [int(i) for i in input().split(' ')]
	if abs(a - b) % 10 == 0:
		result = abs(a - b) // 10
	else:
		result = abs(a - b) // 10 + 1
	print(result)


def solve(x, k):
	if k > x:
		ans = (k - x) // 10
		if (k - x) % 10 == 0:
			return ans
		else:
			return ans + 1
	elif x == k:
		return 0
	else:
		ans = (x - k) // 10
		if (x - k) % 10 == 0:
			return ans
		else:
			return ans + 1
t = int(input())
for _ in range(t):
	(x, k) = map(int, input().split())
	print(solve(x, k))


import math
t = int(input())
for i in range(t):
	ab = list(map(int, input().split()))
	diff = abs(ab[0] - ab[1])
	f = math.ceil(diff / 10)
	print(f)


def get_output(query):
	count = 0
	a = query[0]
	b = query[1]
	(sub_check, add_check) = (0, 0)
	if a == b:
		return 0
	if a > b:
		sub_check = 1
	else:
		add_check = 1
	if sub_check:
		res = a - b
		if res % 2 == 0:
			return 1
		else:
			return 2
	if add_check:
		res = b - a
		if res % 2 != 0:
			return 1
		else:
			return 2
test_cases = int(input())
for i in range(test_cases):
	query = [int(i) for i in input().split()]
	print(get_output(query))


n = int(input())
for r in range(n):
	inp = input()
	lis = list((int(i) for i in inp.split()))
	a = lis[0]
	b = lis[1]
	if a == b:
		print('0')
	elif a < b:
		if (b - a) % 2 == 0:
			print('2')
		else:
			print('1')
	elif a > b:
		if (a - b) % 2 == 0:
			print('1')
		else:
			print('2')


t = int(input())
for i in range(t):
	import math
	n = list(map(int, input().split()))
	a = n[0]
	b = n[1]
	if a > b:
		y = (a - b) / 10
		x = math.ceil(y)
		print(x)
	else:
		k = (b - a) / 10
		l = math.ceil(k)
		print(l)


t = int(input())
for j in range(t):
	(a, b) = map(int, input().strip().split())
	c = 0
	dif = abs(a - b)
	c = int(dif // 10)
	rem = dif % 10
	if rem:
		print(c + 1)
	else:
		print(c)


def main():
	t = int(input())
	while t > 0:
		t -= 1
		(a, b) = [int(i) for i in input().split(' ')]
		if a == b:
			print(0)
			continue
		diff = abs(a - b)
		rez = diff // 10
		if diff % 10 > 0:
			rez += 1
		print(rez)
main()


for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	(ans, rest) = divmod(abs(a - b), 10)
	ans += rest > 0
	print(ans)


def solve():
	(a, b) = map(int, input().split(' '))
	if a == b:
		return 0
	diff = abs(a - b)
	if diff % 10 == 0:
		return int(diff / 10)
	steps = int((diff + (10 - diff % 10)) / 10)
	return steps
tc = int(input())
for _ in range(tc):
	print(solve())


t = int(input())
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	d = abs(a - b)
	m = 0
	if d == 0:
		print('0')
	elif d > 10:
		div = int(d / 10)
		m = m + div
		n = int(d % 10)
		if n == 0:
			print(m)
		elif n <= 10:
			print(m + 1)
	elif d <= 10:
		print('1')


import sys
t = int(sys.stdin.readline())
for line in sys.stdin:
	(a, b) = map(int, line.split())
	if a == b:
		print('0')
	elif a < b:
		if a % 2 == 0 and b % 2 == 0:
			print('2')
		elif a % 2 == 0:
			print('1')
		elif a % 2 == 1 and b % 2 == 0:
			print('1')
		else:
			print('2')
	elif a % 2 == 0 and b % 2 == 0:
		print('1')
	elif a % 2 == 0:
		print('2')
	elif a % 2 == 1 and b % 2 == 0:
		print('2')
	else:
		print('1')


import math

def map_split(function):
	return list(map(function, input().split()))
for _ in range(int(input())):
	(a, b) = map_split(int)
	print(math.ceil(abs(a - b) / 10))


def process():
	(a, b) = list(map(int, input().split()))
	if a <= b:
		moves = (b - a) // 10
		if (b - a) % 10 != 0:
			return moves + 1
		return moves
	else:
		moves = (a - b) // 10
		if (a - b) % 10 != 0:
			return moves + 1
		return moves
tests = int(input())
for i in range(tests):
	print(process())


n = int(input())
l = [i for i in range(1, 11)][::-1]
for i in range(n):
	count = 0
	(a, b) = map(int, input().split())
	if a == b:
		print('0')
	elif a < b:
		b = b - a
		for i in l:
			if b >= i:
				q = b // i
				count += q
				b = b % i
				if b == 0:
					print(count)
					break
	elif a > b:
		a = a - b
		for i in l:
			if a >= i:
				q = a // i
				count += q
				a = a % i
				if a == 0:
					print(count)
					break


import math

def run():
	output = []
	for i in range(int(input())):
		a = input().split()
		b = int(a[0])
		c = int(a[1])
		output.append(str(math.ceil(abs(b - c) / 10)))
	print('\n'.join(output))
run()


testcase = int(input())
for test in range(testcase):
	(a, b) = map(int, input().split())
	if a == b:
		res = 0
	elif a > b:
		dif = a - b
		res = dif // 10
		if dif % 10 != 0:
			res += 1
	else:
		dif = b - a
		res = dif // 10
		if dif % 10 != 0:
			res += 1
	print(res)


import sys, math
for i in range(0, int(sys.stdin.readline())):
	ab = sys.stdin.readline().split()
	d = abs(int(ab[1]) - int(ab[0]))
	sys.stdout.write(str(math.ceil(d / 10)))
	sys.stdout.write('\n')


for case in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	d = abs(a - b)
	ans = 0
	for x in range(10, 0, -1):
		k = d // x
		ans += k
		if k > 0:
			d %= x
	print(ans)


from math import floor

def solve():
	(a, b) = map(int, input().split())
	k = abs(a - b) / 10
	if abs(a - b) % 10 != 0:
		print(floor(k) + 1)
	else:
		print(floor(k))
t = int(input())
for _ in range(t):
	solve()


import math

def get_ans(a, b):
	(a, b) = (min(a, b), max(a, b))
	diff = b - a
	return int(math.ceil(diff / 10))
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	print(get_ans(a, b))


n = int(input())
for i in range(n):
	(a, b) = list(map(int, input().split()))
	if a == b:
		print('0')
	elif a > b:
		c = a - b
		if c % 2 == 0:
			print('1')
		elif c % 2 != 0:
			print('2')
	elif a < b:
		c = b - a
		if c % 2 == 0:
			print('2')
		elif c % 2 != 0:
			print('1')


t = int(input())
for i in range(t):
	(m, n) = map(int, input().split())
	x = abs(m - n)
	c = 0
	while x > 10:
		c += x // 10
		x = x % 10
	if x == 0:
		print(c)
	else:
		c += 1
		print(c)


import math
t = int(input())
for l in range(t):
	(a, b) = list(map(int, input().split(' ')))
	count = 0
	d = abs(a - b)
	if d == 0:
		count = 0
	else:
		count = math.ceil(d / 10)
	print(count)


def getIntegers(a, b):
	val = abs(a - b)
	d = val // 10
	r = val % 10
	if r != 0:
		d += 1
	return d
t = int(input())
for i in range(t):
	(a, b) = tuple(map(int, input().split()))
	print(getIntegers(a, b))


from collections import defaultdict
from heapq import heappop, heappush, heapify
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a < b:
		print(1 if (b - a) % 2 == 1 else 2)
	else:
		print(1 if (a - b) % 2 == 0 else 2)


N = int(input())
for n in range(N):
	(a, b) = list(map(int, input().split()))
	d = abs(a - b)
	print((d + 9) // 10)


n = int(input())
for i in range(n):
	x = input().split()
	a = int(x[0])
	b = int(x[1])
	diff = a - b
	if diff > 0 and diff % 2 == 0:
		print(1)
	elif diff > 0 and diff % 2 != 0:
		print(2)
	elif diff < 0 and diff % 2 == 0:
		print(2)
	elif diff < 0 and diff % 2 != 0:
		print(1)
	else:
		print(0)


import math
for _ in range(int(input())):
	ab = input()
	ab = ab.split()
	(a, b) = (int(ab[0]), int(ab[1]))
	if a > b:
		d = a - b
	elif b > a:
		d = b - a
	else:
		d = 0
	m = d / 10
	print(math.ceil(m))


def f():
	t = int(input())
	arr = []
	for _ in range(t):
		arr.append(list(map(int, input().split())))
	for (a, b) in arr:
		print((abs(a - b) + 9) // 10)
f()


def main(a, b):
	if a == b:
		return 0
	diff = abs(a - b)
	r = diff % 10
	d = int(diff / 10)
	if r == 0:
		return d
	else:
		return d + 1
t = int(input())
for t_itr in range(t):
	ab = list(map(int, input().rstrip().split()))
	a = ab[0]
	b = ab[1]
	res = main(a, b)
	print(res)


import sys

def task():
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	return int((b - a + 9) / 10)
n = int(input())
for i in range(n):
	print(task())


totalInp = int(input())
for i in range(totalInp):
	inp = input().split(' ')
	inp[0] = int(inp[0])
	inp[1] = int(inp[1])
	if inp[1] > inp[0]:
		(inp[0], inp[1]) = (inp[1], inp[0])
	diff = inp[0] - inp[1]
	co = 0
	no = 10
	while diff > 0:
		copyDiff = diff // no
		co += copyDiff
		diff = diff - copyDiff * no
		no -= 1
	print(co)


def solve(number_a, number_b):
	moves = 0
	difference = number_b - number_a
	if difference == 0:
		moves += 0
	elif difference != 0 and abs(difference) % 2 == 0:
		if difference > 0:
			moves += 2
		elif difference < 0:
			moves += 1
	elif difference != 0 and abs(difference) % 2 != 0:
		if difference > 0:
			moves += 1
		elif difference < 0:
			moves += 2
	return moves
t = int(input())
for cases in range(t):
	(a, b) = list(map(int, input().split()))
	print(solve(a, b))


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	steps = abs(b - a)
	if steps % 10 != 0:
		print(steps // 10 + 1)
	else:
		print(steps // 10)


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


import math

def find_min(a, b):
	if a == b:
		return 0
	elif a > b:
		return math.ceil((a - b) / 10)
	elif a < b:
		return math.ceil((b - a) / 10)
k = int(input())
for i in range(k):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	print(find_min(a, b))


t = int(input())
for case in range(t):
	(m, n) = [int(x) for x in input().split()]
	k = abs(m - n)
	print(-(-k // 10))


from sys import stdin, stdout
input = stdin.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = abs(b - a)
	ans = 0
	k = 10
	while x > 1:
		ans += x // k
		x %= k
		k -= 1
	stdout.write(str(ans + x) + '\n')


test_cases = int(input())
for i in range(test_cases):
	(num1, num2) = map(int, input().split())
	diff = abs(num1 - num2)
	if diff % 10 == 0:
		print(diff // 10)
	else:
		print(diff // 10 + 1)


for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	if a == b:
		print('0')
	if a > b:
		s1 = a - b
		r1 = s1 % 2
		if r1 != 0:
			print('2')
		if r1 == 0:
			print('1')
	if b > a:
		s2 = b - a
		r2 = s2 % 2
		if r2 != 0:
			print('1')
		if r2 == 0:
			print('2')


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


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	print((b - a) // 10 + bool((b - a) % 10) if a < b else (a - b) // 10 + bool((a - b) % 10))


t = int(input())
for case in range(t):
	data = [int(x) for x in input().split(' ')]
	a = data[0]
	b = data[1]
	if a == b:
		print(0)
	elif a > b and (a - b) % 2 != 0:
		print(2)
	elif b > a and (a - b) % 2 == 0:
		print(2)
	else:
		print(1)


def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
n = inp()
for i in range(n):
	l = inlt()
	a = l[0]
	b = l[1]
	if b > a and (b - a) % 2 == 1:
		print(1)
	elif b > a and (b - a) % 2 == 0:
		print(2)
	elif b == a:
		print(0)
	elif b < a and (a - b) % 2 == 0:
		print(1)
	else:
		print(2)


import math, collections, sys
input = sys.stdin.readline

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


from math import ceil
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().strip().split())
	if a > b:
		(a, b) = (b, a)
	print(ceil((b - a) / 10))


import math
t = int(input())

def func(a, b):
	return math.ceil(abs(b - a) / 10)
for i in range(t):
	(a, b) = map(int, input().split())
	print(func(a, b))


n = int(input())
for x in range(n):
	A = list(map(int, input().split()))
	(a, b) = (A[0], A[1])
	if b < a:
		(a, b) = (b, a)
	if a == b:
		print(0)
	if b > a:
		if (b - a) % 10 == 0:
			print((b - a) // 10)
		else:
			print((b - a) // 10 + 1)


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


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	count = 0
	k = abs(b - a)
	if a == b:
		print(count)
	elif a < b:
		if k % 10 != 0:
			count += 1
			k -= k % 10
			count += k / 10
		elif k % 10 == 0:
			count += k / 10
		print(int(count))
	elif a > b:
		if k % 10 != 0:
			count += 1
			k -= k % 10
			count += k / 10
		elif k % 10 == 0:
			count += k / 10
		print(int(count))


import math

def isEven(x, y):
	return (x - y) % 2 == 0

def transform(a, b, k):
	if a == b:
		return k
	elif isEven(a, b):
		if a > b:
			return k + 1
		else:
			return k + 2
	elif a > b:
		return k + 2
	else:
		return k + 1
n = int(input())
for i in range(n):
	(a, b) = [int(x) for x in input().split()]
	print(transform(a, b, 0))


for _ in range(int(input())):
	(x, y) = list(map(int, input().split()))
	if x != y:
		if x < y:
			if x % 2 == 0 and y % 2 == 0 or (x % 2 != 0 and y % 2 != 0):
				print(2)
			else:
				print(1)
		elif x % 2 == 0 and y % 2 == 0 or (x % 2 != 0 and y % 2 != 0):
			print(1)
		else:
			print(2)
	else:
		print(0)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a < b:
		diff = b - a
		ans = diff // 10
		if ans == diff / 10:
			count = ans
		else:
			count = ans + 1
		print(count)
	else:
		diff = a - b
		ans = diff // 10
		if ans == diff / 10:
			count = ans
		else:
			count = ans + 1
		print(count)


import math
n_test = int(input())
while n_test:
	(a, b) = input().split()
	a = float(a)
	b = float(b)
	print(math.ceil(abs(a - b) / 10.0))
	n_test -= 1


for t in range(int(input())):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	print((diff - 1) // 10 + 1)


n = int(input())

def number_of_moves(a, b):
	diff = abs(a - b)
	ans = 0 if a == b else 1
	ans = 2 if b > a and diff % 2 == 0 else ans
	ans = 2 if a > b and diff % 2 == 1 else ans
	return ans
for i in range(n):
	inpt = input().strip().split(' ')
	inpt = list(map(lambda x: int(x), inpt))
	answer = number_of_moves(inpt[0], inpt[1])
	print(answer)


n = int(input())
while n:
	(a, b) = map(int, input().split())
	dif = int(b - a)
	if dif == 0:
		print('0')
	elif dif > 0 and dif % 2 != 0:
		print('1\n')
	elif dif < 0 and -1 * dif % 2 == 0:
		print('1\n')
	else:
		print('2')
	n = n - 1


from math import ceil
t = int(input())
for _ in range(t):
	(a, b) = [int(p) for p in input().split()]
	diff = abs(a - b)
	count = diff // 10
	if diff % 10 == 0:
		print(count)
	else:
		print(count + 1)


def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = mpos(sum_so_far, current_sum)
	return sum_so_far

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

def graph(n, m):
	adj = dict()
	for i in range(1, n + 1):
		adj.setdefault(i, 0)
	for i in range(m):
		(a, b) = map(int, input().split())
		adj[a] += 1
		adj[b] += 1
	return adj
import sys
import threading
from math import *
sys.setrecursionlimit(300000)
threading.stack_size(10 ** 8)
po = int(log(10 ** 18)) + 2
li = []
for i in range(po):
	li.append(3 ** i)
li = li[::-1]
s = sum(li)
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	s = abs(a - b)
	print(int(ceil(s / 10)))


import io, os
import sys
from atexit import register
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
sys.stdout = io.BytesIO()
register(lambda : os.write(1, sys.stdout.getvalue()))
tokens = []
tokens_next = 0

def next_str():
	global tokens, tokens_next
	while tokens_next >= len(tokens):
		tokens = input().split()
		tokens_next = 0
	tokens_next += 1
	return tokens[tokens_next - 1]

def nextInt():
	return int(next_str())

def print(s):
	sys.stdout.write((str(s) + '\n').encode())
n = nextInt()
for _ in range(n):
	(a, b) = (nextInt(), nextInt())
	if a == b:
		print(0)
	elif a % 2 == b % 2:
		print(2 if a < b else 1)
	else:
		print(1 if a < b else 2)


import sys
ll = lambda : list(map(int, input().split()))
lls = lambda : list(map(str, input().split()))
fin = lambda : list(map(float, input().split()))
st = lambda : input()
v = lambda : map(int, input().split())
ii = lambda : int(input())
mod = 10 ** 9 + 7
from math import *
from datetime import datetime
from collections import *
import math
for _ in range(ii()):
	(x, y) = v()
	d = abs(x - y)
	print(math.ceil(d / 10))


import math
import itertools
x = lambda : map(int, input().split())

def main():
	n = int(input())
	while n > 0:
		n -= 1
		(a, b) = x()
		ans = 0
		if a < b:
			if a % 2 != 0:
				if b % 2 == 0:
					ans = 1
				else:
					ans = 2
			elif b % 2 == 0:
				ans = 2
			else:
				ans = 1
		elif a > b:
			if a % 2 != 0:
				if b % 2 == 0:
					ans = 2
				else:
					ans = 1
			elif b % 2 == 0:
				ans = 1
			else:
				ans = 2
		print(ans)
main()


import sys
import math
t = int(input())
for j in range(t):
	(a, b) = map(int, input().split())
	diff = abs(b - a)
	if diff == 0:
		print(0)
		continue
	ans = int(math.ceil(diff / 10))
	print(ans)


T = int(input())
for t in range(T):
	(a, b) = list(map(int, input().split()))
	count = abs(a - b) // 10 + bool(abs(a - b) % 10) * 1
	print(count)


def do():
	q = int(input())
	import math
	for _ in range(q):
		(a, b) = map(int, input().split())
		x = abs(a - b)
		print(math.ceil(x / 10))
do()


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


import sys
r = sys.stdin.readline
t = int(r())
for _ in range(t):
	(a, b) = map(int, r().split())
	cnt = 0
	if a == b:
		print(0)
		continue
	else:
		print((abs(a - b) - 1) // 10 + 1)


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.141592653589793
sys.setrecursionlimit(2000)

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)
		elif 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)
	P = [-1] * len(X)
	L = 0
	for i in range(len(X)):
		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]
	return L

def knapsack0(capacity, items):
	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):
	if init:
		maxValue = 10000
		maxPieces = len(wt) + 1
		knapsack3.dp = [[-1 for _i in range(maxPieces)] for _j in range(maxValue)]
	if n == -1:
		n = len(wt)
	if knapsack3.dp[W][n] != -1:
		return knapsack3.dp[W][n]
	if n == 0 or W == 0:
		return 0
	if wt[n - 1] > W:
		return knapsack3(W, wt, val, n - 1, False)
	else:
		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):
	if init:
		maxValue = 10000
		maxPieces = len(pieces)
		minCoinChange.dp = [[-1 for i in range(maxPieces)] for j in range(maxValue)]
	if n == -1:
		n = len(pieces) - 1
	if minCoinChange.dp[value][n] != -1:
		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):
	if init:
		maxValue = 10000
		maxPieces = len(pieces)
		coinChange.dp = [[-1 for i in range(maxPieces)] for j in range(maxValue)]
	if n == -1:
		n = len(pieces) - 1
	if coinChange.dp[value][n] != -1:
		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]

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

def generate_primes(n: int) -> list:
	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)
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))
main()


n = int(input())
for n in range(n):
	m = list(map(int, input().split()))
	(a, b) = (m[0], m[1])
	n = b - a
	c = 0
	if n > 0:
		if n % 2 == 0:
			c += 2
		else:
			c += 1
	elif n < 0:
		if abs(n) % 2 == 0:
			c += 1
		else:
			c += 2
	print(c)


t = int(input())
for i in range(t):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	c = 0
	d = abs(a - b)
	if d // 10 and d % 10:
		print(d // 10 + 1)
	if d // 10 == 0 and a == b:
		print(0)
	if d // 10 == 0 and a != b:
		print(1)
	if d // 10 and (not d % 10):
		print(d // 10)


t = int(input())
for _ in range(t):
	(a, b) = [int(i) for i in input().split()]
	m = abs(b - a) // 10
	if not abs(b - a) % 10:
		print(m)
	else:
		print(m + 1)


import math
t = int(input())
for test in range(t):
	ab = [int(x) for x in input().split()]
	a = ab[0]
	b = ab[1]
	if math.fabs(b - a) == 0:
		print(0)
	elif b > a:
		if (b - a) % 2 == 0:
			print(2)
		else:
			print(1)
	elif (b - a) % 2 == 0:
		print(1)
	else:
		print(2)


T = int(input())
for _ in range(T):
	(a, b) = list(map(int, input().split()))
	x = abs(a - b)
	ct = 0
	k = x // 10
	m = x % 10
	if m != 0:
		ct += 1
	ct += k
	print(ct)


T = lambda : range(int(input()))
A = lambda : list(map(int, input().split()))
for _ in T():
	(a, b) = A()
	if a == b:
		print(0)
		continue
	x = abs(a - b)
	if x % 10 == 0:
		print(x // 10)
	else:
		print(x // 10 + 1)


import math
t = int(input())
for i in range(t):
	count = 0
	(a, b) = map(int, input().split())
	c = abs(a - b)
	if math.ceil(c / 10) == c // 10:
		print(c // 10)
	else:
		print(c // 10 + 1)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a < b:
		b -= a
		print((b + 9) // 10)
	else:
		a -= b
		print((a + 9) // 10)


import math
T = int(input())
for _ in range(T):
	(n1, n2) = map(int, input().split())
	print((abs(n1 - n2) + 9) // 10)


import io
import os
from collections import Counter, defaultdict, deque

def solve(A, B):
	if A == B:
		return 0
	if A < B:
		if (B - A) % 2 == 0:
			return 2
		else:
			return 1
	elif (B - A) % 2 == 1:
		return 2
	else:
		return 1
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(A, B) = [int(x) for x in input().split()]
	ans = solve(A, B)
	print(ans)


testes = int(input())
for t in range(testes):
	ent = input().split(' ')
	a = int(ent[0])
	b = int(ent[1])
	dif = abs(a - b) % 2
	moves = 0
	if a == b:
		moves = 0
	elif a < b:
		if dif == 0:
			moves = 2
		else:
			moves = 1
	elif dif == 0:
		moves = 1
	else:
		moves = 2
	print(moves)


import sys
n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	if a < b:
		if (b - a) % 2 == 1:
			print(1)
		else:
			print(2)
	elif a > b:
		if (a - b) % 2 == 0:
			print(1)
		else:
			print(2)


import math

def func(a, b):
	maxy = max(a, b)
	mini = min(a, b)
	c = math.ceil((maxy - mini) / 10)
	return c
n = int(input())
for _ in range(n):
	x = input()
	(a, b) = (int(x.split()[0]), int(x.split()[1]))
	k = func(a, b)
	print(k)


for i in range(0, int(input())):
	ab = input().split()
	print(int((abs(int(ab[0]) - int(ab[1])) + 9) / 10))


n = int(input())
for i in range(n):
	k = list(map(int, input().split()))
	s = abs(k[0] - k[1])
	if s % 10 == 0:
		print(s // 10)
	else:
		print(s // 10 + 1)


t = int(input())
for i in range(t):
	(a, b) = input().strip().split(' ')
	(a, b) = [int(a), int(b)]
	if a - b == 0:
		print(0)
	elif a - b < 0:
		k = a - b
		f = 1
		if not k % 2:
			f += 1
		print(f)
	else:
		k = abs(a - b)
		f = 1
		if k % 2:
			f += 1
		print(f)


import sys
import os
import heapq
import math
try:
	path = './file/input.txt'
	if os.path.exists(path):
		sys.stdin = open(path, 'r')
except:
	pass
t = int(input())

def printd(value):
	pass

def case():
	arr = list(map(int, input().split(' ')))
	(a, b) = (arr[0], arr[1])
	c = a - b if a > b else b - a
	print(c // 10 + (1 if c % 10 > 0 else 0))
for _ in range(t):
	case()


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	pA = a % 2
	pB = b % 2
	if a == b:
		print('0')
	elif a < b and pA == pB:
		print('2')
	elif a < b and pA != pB:
		print('1')
	elif b < a and pA == pB:
		print('1')
	elif b < a and pA != pB:
		print('2')


for test in range(int(input())):
	(a, b) = map(int, input().strip().split(' '))
	count = 0
	if a == b:
		print(0)
	elif a > b:
		x = a - b
		while True:
			i = 10
			flag = 0
			while i > 0:
				if int(x / i) > 0:
					flag = int(x / i)
					x -= int(x / i) * i
					break
				i -= 1
			count += 1 * flag
			if x == 0:
				break
		print(count)
	else:
		x = b - a
		while True:
			i = 10
			flag = 0
			while i > 0:
				if int(x / i) > 0:
					flag = int(x / i)
					x -= int(x / i) * i
					break
				i -= 1
			count += 1 * flag
			if x == 0:
				break
		print(count)


T = int(input())
for __ in range(T):
	(a, b) = map(int, input().split())
	abd = abs(b - a)
	ans = abd // 10
	if abd % 10 != 0:
		ans += 1
	print(ans)


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	l = abs(a - b)
	if l % 10 == 0:
		print(l // 10)
	else:
		print(l // 10 + 1)


T = int(input())
while T > 0:
	T -= 1
	(x, y) = map(int, input().split(' '))
	if x == y:
		print('0')
	elif x & 1 ^ y & 1 and x < y:
		print('1')
	elif x & 1 == y & 1 and x > y:
		print('1')
	else:
		print('2')


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


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	c = 0
	if a == b:
		print(0)
		continue
	if b < a:
		(a, b) = (b, a)
	d = (b - a) % 10
	if d > 0:
		c = 1
	a = a + d
	c += (b - a) // 10
	print(c)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	l = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
	d = abs(a - b)
	c = d // 10
	if d % 10 != 0:
		c += 1
	print(c)


from functools import reduce
import os
import sys
from collections import *
from math import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))

def parr():
	return [value() for i in range(n)]
mo = 1000000007
inf = 1e+18
for _ in range(inn()):
	(a, b) = value()
	if a == b:
		print(0)
	elif a > b:
		if (a - b) % 2 == 0:
			print(1)
		else:
			print(2)
	elif (b - a) % 2 == 0:
		print(2)
	else:
		print(1)


t = int(input())
while t:
	t -= 1
	(a, b) = [int(i) for i in input().split()]
	if a == b:
		print('0')
	elif b > a:
		if (b - a) % 2 != 0:
			print('1')
		elif (b - a) % 2 == 0:
			print('2')
	elif a > b:
		if (a - b) % 2 == 0:
			print('1')
		elif (a - b) % 2 != 0:
			print('2')


for _ in [0] * int(input()):
	a = list(map(int, input().split()))
	a.sort()
	print((a[1] - a[0]) // 10 if (a[1] - a[0]) % 10 == 0 else (a[1] - a[0]) // 10 + 1)


def main():
	t = int(input())
	while t > 0:
		(a, b) = map(int, input().split())
		diff = abs(a - b)
		cnt = diff // 10
		diff = diff % 10
		if diff > 0 and diff < 10:
			cnt = cnt + 1
		print(cnt)
		t -= 1
main()


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


from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
from collections import Counter
from math import sqrt
import collections
import math
import heapq
import re

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def most_frequent(list):
	return max(set(list), key=list.count)

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def Convert(string):
	li = list(string.split(''))
	return li

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
prime = []
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j

def main():
	for _ in range(inin()):
		(a, b) = map(int, input().split())
		temp = abs(a - b)
		if temp == 0:
			print(0)
		elif temp <= 10:
			print(1)
		elif temp % 10 != 0:
			print(int(str(temp)[:-1]) + 1)
		else:
			print(int(str(temp)[:-1]))
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for i in range(int(input())):
	k = 0
	(a, b) = map(int, input().split())
	if (a + b) % 2 == 0:
		if a > b:
			k = 1
		elif a < b:
			k = 2
	elif a > b:
		k = 2
	elif a < b:
		k = 1
	print(k)


t = int(input())
while t != 0:
	(A, B) = input().split()
	a = int(A)
	b = int(B)
	x = abs(a - b)
	if x % 10 == 0:
		print(int(x / 10))
	else:
		print(int(x / 10) + 1)
	t = t - 1


from math import ceil
i = int(input())
lst = []
for j in range(i):
	p = input().split(' ')
	p = list(map(lambda x: int(x), p))
	r = abs(p[1] - p[0])
	lst.append(str(ceil(r / 10)))
print('\n'.join(lst))


from sys import stdin, stdout

def find(A, B):
	H = abs(B - A)
	return H // 10 + int(bool(H % 10))

def main():
	for _ in range(int(stdin.readline())):
		(A, B) = list(map(int, stdin.readline().split()))
		print(find(A, B))
main()


T = int(input())
for _ in range(T):
	(a, b) = list(map(int, input().split()))
	diff = abs(a - b)
	result = diff // 10 + (1 if diff % 10 > 0 else 0)
	print(result)


import sys

def input():
	return sys.stdin.readline()[:-1]

def getInt():
	return int(input())

def getIntIter():
	return map(int, input().split())

def getIntList():
	return list(getIntIter())
for _ in range(int(input())):
	(a, b) = getIntIter()
	diff = abs(a - b)
	diff += 9
	diff = diff // 10
	print(diff)


l = []
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	s = abs(a - b)
	n = s // 10
	if s % 10 == 0:
		l.append(n)
	else:
		l.append(n + 1)
for i in l:
	print(i)


cases = int(input())
while cases > 0:
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	if diff == 0:
		print(0)
	elif a > b:
		if diff % 2 != 0:
			print(2)
		elif diff % 2 == 0:
			print(1)
	elif b > a:
		if diff % 2 != 0:
			print(1)
		elif diff % 2 == 0:
			print(2)
	cases -= 1


li = []
test = int(input())
for i in range(test):
	li = list(map(int, input().split()))
	if li[0] > li[1]:
		if (li[0] - li[1]) % 2 == 0:
			print('1')
		else:
			print('2')
	elif li[0] < li[1]:
		if (li[1] - li[0]) % 2 == 1:
			print('1')
		else:
			print('2')
	else:
		print('0')


import heapq as hq
from heapq import heappop, heappush
from collections import deque, defaultdict, Counter

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())

def subset_sum_count(arr, n, sum):
	dp = [[0 for _ in range(sum + 1)] for _ in range(n + 1)]
	for i in range(n + 1):
		for j in range(sum + 1):
			if j == 0:
				dp[i][j] = 1
			elif arr[i - 1] <= j:
				dp[i][j] = dp[i - 1][j - arr[i - 1]] + dp[i - 1][j]
			else:
				dp[i][j] = dp[i - 1][j]
	return dp[n][sum]

def prefix(a):
	pre = []
	pre.append(a[0])
	for i in range(1, len(a)):
		pre.append(pre[i - 1] + a[i])
	return pre

def binary_search(func, lo, hi, abs_prec=1e-07):
	while abs(hi - lo) > abs_prec:
		mi = lo + (hi - lo) / 2
		if func(mi):
			hi = mi
		else:
			lo = mi
	return (lo + hi) / 2

def ternary_search(func, lo, hi, abs_prec=1e-07):
	while abs(hi - lo) > abs_prec:
		lo_third = lo + (hi - lo) / 3
		hi_third = hi - (hi - lo) / 3
		if func(lo_third) < func(hi_third):
			lo = lo_third
		else:
			hi = hi_third
	return (lo + hi) / 2

def discrete_binary_search(func, lo, hi):
	while lo < hi:
		mi = lo + (hi - lo) // 2
		if func(mi):
			hi = mi
		else:
			lo = mi + 1
	return lo

def discrete_ternary_search(func, lo, hi):
	while lo <= hi:
		lo_third = lo + (hi - lo) // 3
		hi_third = lo + (hi - lo) // 3 + (1 if 0 < hi - lo < 3 else (hi - lo) // 3)
		if func(lo_third) < func(hi_third):
			lo = lo_third + 1
		else:
			hi = hi_third - 1
	return lo
	return -1

def right_rotate(a, s):
	return a[s:] + a[:s]

def dec_to_bin(x):
	return int(bin(x)[2:])

def str_to_integer_list(n):
	a = []
	for i in range(len(n)):
		a.append(int(n[i]))
	return a

def list_to_str(l):
	s = ''
	for i in l:
		s += str(i)
	return s

def dijkstra(s, N, E):
	visited = set()
	dist = {}
	for i in range(1, N + 1):
		dist[i] = 1 << 29
	queue = [(dist[i], i) for i in range(1, N + 1)]
	hq.heappush(queue, (0, s))
	dist[s] = 0
	while queue:
		(d, u) = hq.heappop(queue)
		if u in visited:
			continue
		for t in E[u]:
			(v, r) = t
			if dist[v] > d + r:
				dist[v] = d + r
				hq.heappush(queue, (dist[v], v))
		visited.add(u)
	return dist

def prime_sieve(n):
	flag = n % 6 == 2
	sieve = bytearray((n // 3 + flag >> 3) + 1)
	for i in range(1, int(n ** 0.5) // 3 + 1):
		if not sieve[i >> 3] >> (i & 7) & 1:
			k = 3 * i + 1 | 1
			for j in range(k * k // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
			for j in range(k * (k - 2 * (i & 1) + 4) // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
	return sieve

def prime_list(n):
	res = []
	if n > 1:
		res.append(2)
	if n > 2:
		res.append(3)
	if n > 4:
		sieve = prime_sieve(n + 1)
		res.extend((3 * i + 1 | 1 for i in range(1, (n + 1) // 3 + (n % 6 == 1)) if not sieve[i >> 3] >> (i & 7) & 1))
	return res

def dijkstra(n, graph, start):
	(dist, parents) = ([float('inf')] * n, [-1] * n)
	dist[start] = 0
	queue = [(0, start)]
	while queue:
		(path_len, v) = heappop(queue)
		if path_len == dist[v]:
			for (w, edge_len) in graph[v]:
				if edge_len + path_len < dist[w]:
					(dist[w], parents[w]) = (edge_len + path_len, v)
					heappush(queue, (edge_len + path_len, w))
	return (dist, parents)

def path(start, end, parent):
	path = [end]
	while path[-1] != start:
		path.append(parent[path[-1]])
	path.reverse()
	return path

def bfs(graph, start, goal):
	if start == goal:
		return [start]
	visited = {start}
	queue = deque([(start, [])])
	while queue:
		(current, path) = queue.popleft()
		visited.add(current)
		for neighbor in graph[current]:
			if neighbor == goal:
				return path + [current, neighbor]
			if neighbor in visited:
				continue
			queue.append((neighbor, path + [current]))
			visited.add(neighbor)
	return None
import os
import sys
from io import BytesIO, IOBase

def DecimalToBinary(n):

	def helper(n):
		if n == 0:
			return ''
		else:
			if n % 2 == 1:
				binaryDigit = '1'
			else:
				binaryDigit = '0'
			return helper(n // 2) + binaryDigit
	if n == 0:
		result = '0'
	else:
		result = helper(n)
	return result

def p(board):
	for i in range(8):
		s = ''
		for j in range(8):
			s += board[i][j]
		print(s)

def binaryToDecimal(n):
	return int(n, 2)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def solve(a, b):
	x = DecimalToBinary(a)
	y = DecimalToBinary(b)
	z = x + y
	l = y + x
	r = binaryToDecimal(z) - binaryToDecimal(l)
	return r

def mostFrequent(arr, n):
	arr.sort()
	max_count = 1
	res = arr[0]
	curr_count = 1
	for i in range(1, n):
		if arr[i] == arr[i - 1]:
			curr_count += 1
		else:
			if curr_count > max_count:
				max_count = curr_count
				res = arr[i - 1]
			curr_count = 1
	if curr_count > max_count:
		max_count = curr_count
		res = arr[n - 1]
	return res
from bisect import bisect_right, bisect_left

def lds(arr, n):
	lds = [0] * n
	max = 0
	for i in range(n):
		lds[i] = 1
	for i in range(1, n):
		for j in range(i):
			if arr[i] < arr[j] and lds[i] < lds[j] + 1:
				lds[i] = lds[j] + 1
	for i in range(n):
		if max < lds[i]:
			max = lds[i]
	return max
import math

def solve():
	for _ in range(inp()):
		(a, b) = invr()
		x = abs(b - a)
		if x % 10 == 0:
			print(x // 10)
		else:
			print(x // 10 + 1)
solve()


import math
n = int(input())
for x in range(n):
	i = list(map(float, input().split()))
	k = abs(i[0] - i[1])
	l = k / 10
	print(math.ceil(l))


test_case = int(input())
for i in range(test_case):
	values = list(map(int, input().split(' ')))
	if values[0] == values[1]:
		print(0)
	elif abs(values[1] - values[0]) < 11:
		print(1)
	else:
		a = abs(values[1] - values[0])
		if a % 10 == 0:
			print(a // 10)
		else:
			print(a // 10 + 1)


t = int(input())
for i in range(t):
	(a, b) = sorted(list(map(int, input().split())))
	moves = (b - a) // 10
	if (b - a) % 10 > 0:
		moves += 1
	print(moves)


from math import ceil

def map_input(type=1):
	if type == 1:
		return map(int, input().split())
	elif type == 2:
		return map(float, input().split())
	elif type == 3:
		return map(str, input().split())
	return None

def list_input(type=1):
	return list(map_input(type))

def give_excel_column_name(r: int):
	l = 1
	r -= 1
	ans: str = ''
	while 26 ** l <= r:
		r -= 26 ** l
		l += 1
	while l > 0:
		ans += chr(ord('A') + r // 26 ** (l - 1) % 26)
		l -= 1
	return ans

def give_excel_column_number(name: str):
	p = 1
	ans: int = 0
	for j in range(len(name)):
		ans = ans + p * (ord(name[j]) - ord('A') + 1)
		p = p * 26
	return ans

def sorted_indices(s):
	li = []
	for i in range(len(s)):
		li.append([s[i], i])
	li.sort()
	return [x[1] for x in li]

def floorSearch(arr, x, low=-1, high=-1):
	if low == -1:
		low = 0
	if high == -1:
		high == len(arr) - 1
	if low > high:
		return -1
	if x >= arr[high]:
		return high
	mid = int((low + high) / 2)
	if arr[mid] == x:
		return mid
	if mid > 0 and arr[mid - 1] <= x and (x < arr[mid]):
		return mid - 1
	if x < arr[mid]:
		return floorSearch(arr, low, mid - 1, x)
	return floorSearch(arr, mid + 1, high, x)

def find_index(arr, x):
	low = 0
	high = len(arr) - 1
	mid = 0
	while low <= high:
		mid = (high + low) // 2
		if arr[mid] < x:
			low = mid + 1
		elif arr[mid] > x:
			high = mid - 1
		else:
			return mid
	return -1

def floyd_warshell(g):
	n = len(g)
	d = g.copy()
	for k in range(n):
		for i in range(n):
			for j in range(n):
				d[i][j] = min(d[i][j], d[i][k] + d[k][j])
	return d

def int_input(type=1):
	if type == 1:
		return int(input())
	elif type == 2:
		return float(int(input()))

def range_input():
	return range(int_input())

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def main():
	for _ in range_input():
		(a, b) = map_input()
		print(ceil(abs(a - b) / 10))
try:
	main()
except:
	pass


def equal(a, b):
	if a > b:
		diff = a - b
	else:
		diff = b - a
	count = 0
	while diff != 0:
		if diff > 10:
			count += diff // 10
			diff = diff % 10
		else:
			count += 1
			return count
	return count
t = int(input())
for i in range(0, t):
	inp = list(map(int, input().split()))
	a = inp[0]
	b = inp[1]
	ans = equal(a, b)
	print(ans)


import math
t = int(input())
for i in range(0, t):
	(a, b) = map(int, input().split())
	p = abs(a - b) / 10
	print(math.ceil(p))


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


import math
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if n > m:
		print(math.ceil((n - m) / 10))
	elif m > n:
		print(math.ceil((m - n) / 10))
	else:
		print('0')


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	d = abs(a - b)
	x = d / 10
	if x > d // 10:
		print(int(x + 1))
	else:
		print(int(x))


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


import itertools
from bisect import bisect_left, bisect_right

def find_ge(a, x):
	i = bisect_left(a, x)
	if i != len(a):
		return a[i]
	return a[-1]

def find_le(a, x):
	i = bisect_right(a, x)
	if i:
		return a[i - 1]
	return a[0]

def main():
	v = int(input())
	for i in range(v):
		(a, b) = [int(v) for v in input().split()]
		if a == b:
			print(0)
		elif a < b:
			if a % 2 == 0 and b % 2 == 0:
				print(2)
			elif a % 2 == 0 and b % 2 != 0:
				print(1)
			elif a % 2 != 0 and b % 2 == 0:
				print(1)
			else:
				print(2)
		elif a % 2 == 0 and b % 2 == 0:
			print(1)
		elif a % 2 == 0 and b % 2 != 0:
			print(2)
		elif a % 2 != 0 and b % 2 == 0:
			print(2)
		else:
			print(1)
main()


import io, os, math
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
rr = lambda : input()
rri = lambda : int(input())
rrm = lambda : list(map(int, input().split()))
INF = float('inf')

def solve(A, B):
	diff = abs(B - A)
	return diff // 10 + +(diff % 10 != 0)
t = rri()
for _ in range(t):
	(a, b) = rrm()
	print(solve(a, b))


import sys
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.141592653589793

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

def read_int():
	return int(sys.stdin.readline().strip())

def read_ints():
	return map(int, sys.stdin.readline().strip().split())

def read_ints2(x):
	return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())

def read_str_list():
	return list(sys.stdin.readline().strip().split())

def read_int_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def GCD(a: int, b: int) -> int:
	return b if a % b == 0 else GCD(b, a % b)

def LCM(a: int, b: int) -> int:
	return a * b // GCD(a, b)

def Main():
	for _ in range(read_int()):
		(a, b) = read_ints()
		ans = 0
		tmp = abs(a - b)
		ans += tmp // 10
		if tmp % 10:
			ans += 1
		print(ans)
Main()


import sys

def input():
	return sys.stdin.readline().rstrip('\r\n')
for case in range(int(input())):
	(a, b) = map(int, input().split())
	dif = abs(a - b)
	if a > b:
		if dif & 1:
			print(2)
		else:
			print(1)
	elif a < b:
		if dif & 1:
			print(1)
		else:
			print(2)
	else:
		print(0)


T = int(input())
for i in range(T):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	diferencia = ((a - b) ** 2) ** (1 / 2)
	k = diferencia // 10
	if diferencia - diferencia // 10 * 10 > 0:
		k += 1
	print(int(k))


t = int(input())
while t:
	a = input().split()
	ans = 0
	d = abs(int(a[0]) - int(a[1]))
	ans = d // 10
	if d % 10 != 0:
		ans += 1
	print(ans)
	t -= 1


for i in range(int(input())):
	(x, y) = [int(j) for j in input().split(' ')]
	print((abs(y - x) + 9) // 10)


from math import ceil
for _ in range(int(input())):
	nos = map(int, input().split())
	(a, b) = nos
	if a == b:
		print('0')
	else:
		if a > b:
			subs = a - b
			quotient = ceil(subs / 10)
		else:
			subs = b - a
			quotient = ceil(subs / 10)
		print(quotient)


try:
	from math import ceil
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		print(ceil(abs(a - b) / 10))
except:
	pass


def process():
	(a, b) = list(map(int, input().split()))
	if a == b:
		print('0\n')
		return 0
	if a % 2 == 1 and b % 2 == 0 and (a < b):
		print('1\n')
		return
	if a % 2 == 1 and b % 2 == 1 and (a < b):
		print('2\n')
		return
	if a % 2 == 0 and b % 2 == 1 and (a < b):
		print('1\n')
		return
	if a % 2 == 0 and b % 2 == 0 and (a < b):
		print('2\n')
		return
	if a % 2 == 1 and b % 2 == 0 and (a > b):
		print('2\n')
		return
	if a % 2 == 1 and b % 2 == 1 and (a > b):
		print('1\n')
		return
	if a % 2 == 0 and b % 2 == 1 and (a > b):
		print('2\n')
		return
	if a % 2 == 0 and b % 2 == 0 and (a > b):
		print('1\n')
		return
tests = int(input())
for i in range(0, tests):
	process()


import math

def main():
	(a, b) = map(int, input().strip().split())
	count = int(math.ceil(abs(a - b) / 10))
	print(count)
for _ in range(int(input())):
	main()


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


from sys import stdin, stdout
import math
import heapq
t = 1

def aint():
	return int(input().strip())

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

def fint():
	return list(map(int, stdin.readline().split()))

def main():
	(a, b) = lint()
	d = b - a
	if a == b:
		print(0)
	elif d > 0:
		if d % 2 == 1:
			print(1)
		else:
			print(2)
	elif d % 2 == 1:
		print(2)
	else:
		print(1)
t = int(input())
for i in range(t):
	main()


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


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

def test():
	t = int(input())
	while t:
		main()
		t -= 1
test()


n = int(input())
counter = 0
ans = []
while counter < n:
	p = input().split(' ')
	(a, b) = (int(p[0]), int(p[1]))
	x = abs(b - a)
	if x % 10 == 0:
		s = x / 10
	else:
		s = x // 10 + 1
	ans.append(s)
	counter += 1
for x in ans:
	print(int(x))


import math
n = int(input())
for i in range(n):
	count = 0
	(a, b) = map(int, input().split())
	if a < b:
		diff = b - a
	else:
		diff = a - b
	print(math.ceil(diff / 10))


def moves(a, b):
	if a == b:
		return 0
	if a > b:
		if (a - b) % 2 == 0:
			return 1
		return 2
	if (b - a) % 2 == 1:
		return 1
	return 2
t = int(input())
for i in range(t):
	(a, b) = map(int, input().strip().split())
	ans = moves(a, b)
	print(ans)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	m = abs(a - b)
	d = m // 10
	if 10 * d != m:
		print(d + 1)
	else:
		print(d)


from __future__ import division, print_function
from sys import stdin, stdout
import bisect
import math
import heapq
i_m = 9223372036854775807

def inin():
	return int(input())

def stin():
	return input()

def spin():
	return map(int, stin().split())

def lin():
	return list(map(int, stin().split()))

def matrix(n):
	return [list(map(int, input().split())) for i in range(n)]

def string2intlist(s):
	return list(map(int, s))

def calculate_sum(a, N):
	m = N / a
	sum = m * (m + 1) / 2
	ans = a * sum
	return ans

def series(N):
	return N * (N + 1) // 2

def count2Dmatrix(i, list):
	return sum((c.count(i) for c in list))

def modinv(n, p):
	return pow(n, p - 2, p)

def GCD(x, y):
	x = abs(x)
	y = abs(y)
	if min(x, y) == 0:
		return max(x, y)
	while y:
		(x, y) = (y, x % y)
	return x

def LCM(x, y):
	return x * y // GCD(x, y)

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def isprime(n):
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True
prime = []

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j
for _ in range(inin()):
	(a, b) = spin()
	if a % 10 == b % 10:
		print(abs(a - b) // 10)
	else:
		print(abs(a - b) // 10 + 1)


import math
n = int(input())
arr = [list(map(int, input().split(' '))) for _ in range(n)]
for item in arr:
	dif = max(item) - min(item)
	s = dif / 10
	print(math.ceil(s))


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 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')
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)
	elif abs(a - b) % 2 == 0:
		print(1)
	else:
		print(2)


t = int(input())
for you in range(t):
	l = input().split()
	a = int(l[0])
	b = int(l[1])
	z = abs(a - b)
	print((z + 9) // 10)


import sys
import math
read = lambda : list(map(int, sys.stdin.readline().strip().split()))
for _ in range(int(input())):
	(a, b) = read()
	if a == b:
		print('0')
		continue
	if b < a:
		if (a - b) % 2 == 0:
			print('1')
		else:
			print('2')
	elif (b - a) % 2 == 0:
		print('2')
	else:
		print('1')


t = int(input())
for _ in range(t):
	(a, b) = [int(x) for x in input().split()]
	h = max(a, b)
	l = min(a, b)
	ans = (h - l) // 10
	if (h - l) % 10 != 0:
		ans += 1
	print(ans)


def nabor(a, b):
	razn = abs(a - b)
	if razn % 10 == 0:
		return razn // 10
	else:
		return razn // 10 + 1
myList = []
t = int(input())
for i in range(t):
	myList.append(list(map(int, input().split())))
for i in range(t):
	print(nabor(myList[i][0], myList[i][1]))


z = int(input())
d = []
for i in range(z):
	x = list(map(int, input().split()))
	c = 0
	a = x[0]
	b = x[1]
	while a != b:
		if b > a:
			s = (b - a) // 10
			a += s * 10
			c += s
			s = (b - a) // 9
			a += s * 9
			c += s
			s = (b - a) // 8
			a += s * 8
			c += s
			s = (b - a) // 7
			a += s * 7
			c += s
			s = (b - a) // 6
			a += s * 6
			c += s
			s = (b - a) // 5
			a += s * 5
			c += s
			s = (b - a) // 4
			a += s * 4
			c += s
			s = (b - a) // 3
			a += s * 3
			c += s
			s = (b - a) // 2
			a += s * 2
			c += s
			s = (b - a) // 1
			a += s
			c += s
		else:
			s = (a - b) // 10
			a -= s * 10
			c += s
			s = (a - b) // 9
			a -= s * 9
			c += s
			s = (a - b) // 8
			a -= s * 8
			c += s
			s = (a - b) // 7
			a -= s * 7
			c += s
			s = (a - b) // 6
			a -= s * 6
			c += s
			s = (a - b) // 5
			a -= s * 5
			c += s
			s = (a - b) // 4
			a -= s * 4
			c += s
			s = (a - b) // 3
			a -= s * 3
			c += s
			s = (a - b) // 2
			a -= s * 2
			c += s
			s = (a - b) // 1
			a -= s
			c += s
	d.append(c)
for i in d:
	print(i)


def sol(n, m):
	x = max(n, m)
	y = min(n, m)
	p = x - y
	if p % 10 == 0:
		print(p // 10)
	else:
		print(p // 10 + 1)
k = int(input())
for i in range(k):
	(n, m) = list(map(int, input().split(' ')))
	sol(n, m)


n = int(input())
for i in range(n):
	l = [int(x) for x in input().split()]
	print(int((abs(l[0] - l[1]) + 9) / 10))


import math

def doit(a):
	print(math.ceil(min(abs(a[1] - a[0]), abs(a[0] - a[1])) / 10))
for i in range(int(input())):
	doit(list(map(int, input().split())))


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


import math
for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	diff = abs(a - b)
	moves = diff / 10
	print(math.ceil(moves))


for _ in range(int(input())):
	(A, B) = list(map(int, input().split()))
	N = B - A
	if N > 0 and N % 2 == 0 or (N < 0 and N % 2 != 0):
		print(2)
	elif N > 0 and N % 2 != 0 or (N < 0 and N % 2 == 0):
		print(1)
	else:
		print(0)


def solve(a, b):
	diff = abs(a - b)
	if a > b:
		return 1 if diff % 2 == 0 else 2
	elif a < b:
		return 2 if diff % 2 == 0 else 1
	return 0
t = int(input())
for x in range(t):
	(a, b) = map(int, input().split(' '))
	print(solve(a, b))


t = int(input())
result = str()
for i in range(t):
	(a, b) = list(map(int, input().split()))
	r = abs(a - b)
	if a == b:
		result = f'{result}\n0'.strip()
	elif a > b:
		if r % 2:
			result = f'{result}\n2'.strip()
		else:
			result = f'{result}\n1'.strip()
	elif a < b:
		if r % 2:
			result = f'{result}\n1'.strip()
		else:
			result = f'{result}\n2'.strip()
print(result)


def sol():
	T = int(input())
	for i in range(T):
		(a, b) = map(int, input().split(' '))
		if a == b:
			ans = 0
		elif a > b:
			if a % 2 == b % 2:
				ans = 1
			elif a % 2 != b % 2:
				ans = 2
		elif a % 2 == b % 2:
			ans = 2
		elif a % 2 != b % 2:
			ans = 1
		print(ans)
sol()


n = int(input())
i = 0
result = list()
final = list()
while i < n:
	a_and_b = input().split()
	a = int(a_and_b[0])
	b = int(a_and_b[1])
	if a == b:
		result.append(0)
	elif b > a:
		result.append(b - a)
	else:
		result.append(b - a)
	i += 1
for j in result:
	if j < 0:
		r = 0
		rest = -1 * j
		if j * -1 > 0:
			if j * -1 >= 10:
				w = j * -1 // 10
				rest = j * -1 - w * 10
				r += w
				if rest == 0:
					final.append(r)
			if rest >= 9:
				w = rest // 9
				rest = rest - w * 9
				r += w
				if rest == 0:
					final.append(r)
			if rest >= 8:
				w = rest // 8
				rest = rest - w * 8
				r += w
				if rest == 0:
					final.append(r)
			if rest >= 7:
				w = rest // 7
				r += w
				rest = rest - w * 7
				if rest == 0:
					final.append(r)
			if rest >= 6:
				w = rest // 6
				r += w
				rest = rest - w * 6
				if rest == 0:
					final.append(r)
			if rest >= 5:
				w = rest // 5
				r += w
				rest = rest - w * 5
				if rest == 0:
					final.append(r)
			if rest >= 4:
				w = rest // 4
				r += w
				rest = rest - w * 4
				if rest == 0:
					final.append(r)
			if rest >= 3:
				w = rest // 3
				r += w
				rest = rest - w * 3
				if rest == 0:
					final.append(r)
			if rest >= 2:
				w = rest // 2
				r += w
				rest = rest - w * 2
				if rest == 0:
					final.append(r)
			if rest == 1:
				r += 1
				rest -= 1
				if rest == 0:
					final.append(r)
	elif j == 0:
		final.append(0)
	elif j > 0:
		r = 0
		rest = j
		if j > 0:
			if j >= 10:
				w = j // 10
				rest = j - w * 10
				r += w
				if rest == 0:
					final.append(r)
			if rest >= 9:
				w = rest // 9
				rest = rest - w * 9
				r += w
				if rest == 0:
					final.append(r)
			if rest >= 8:
				w = rest // 8
				rest = rest - w * 8
				r += w
				if rest == 0:
					final.append(r)
			if rest >= 7:
				w = rest // 7
				r += w
				rest = rest - w * 7
				if rest == 0:
					final.append(r)
			if rest >= 6:
				w = rest // 6
				r += w
				rest = rest - w * 6
				if rest == 0:
					final.append(r)
			if rest >= 5:
				w = rest // 5
				r += w
				rest = rest - w * 5
				if rest == 0:
					final.append(r)
			if rest >= 4:
				w = rest // 4
				r += w
				rest = rest - w * 4
				if rest == 0:
					final.append(r)
			if rest >= 3:
				w = rest // 3
				r += w
				rest = rest - w * 3
				if rest == 0:
					final.append(r)
			if rest >= 2:
				w = rest // 2
				r += w
				rest = rest - w * 2
				if rest == 0:
					final.append(r)
			if rest == 1:
				r += 1
				rest -= 1
				if rest == 0:
					final.append(r)
for e in final:
	print(e)


import math

def main():
	t = int(input())
	results = []
	for i in range(t):
		inp = input().split(' ')
		a = int(inp[0])
		b = int(inp[1])
		if a >= b:
			diff = a - b
		else:
			diff = b - a
		res = diff // 10
		if diff % 10 != 0:
			res += 1
		results.append(res)
	for res in results:
		print(res)
main()


def Moves(a, b):
	if a == b:
		return 0
	elif a > b:
		if a % 2 == 0 and b % 2 == 0 or (a % 2 == 1 and b % 2 == 1):
			return 1
		else:
			return 2
	elif a % 2 == 0 and b % 2 == 0 or (a % 2 == 1 and b % 2 == 1):
		return 2
	else:
		return 1
t = int(input())
for i in range(t):
	s = input()
	s = s.split()
	a = int(s[0])
	b = int(s[1])
	x = Moves(a, b)
	print(x)


T = int(input())
for i in range(T):
	inp = list(map(int, input().split()))
	a = inp[0]
	b = inp[1]
	if a == b:
		print(0)
	moves = 0
	if a > b:
		if (a - b) % 10 == 0:
			moves = (a - b) / 10
		else:
			moves = (a - b) // 10 + 1
		print(int(moves))
	if b > a:
		if (b - a) % 10 == 0:
			moves = (b - a) / 10
		else:
			moves = (b - a) // 10 + 1
		print(int(moves))


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 998244353
EPS = 1e-06

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	(a, b) = value()
	need = abs(b - a)
	print(ceil(need / 10))


t = int(input())

def Yet(a, b):
	d = abs(a - b)
	if d % 10 != 0:
		return d // 10 + 1
	else:
		return d // 10
l = []
for i in range(t):
	(a, b) = map(int, input().split(' '))
	l.append(Yet(a, b))
for _ in l:
	print(_)


for i in range(int(input())):
	(z, x) = map(int, input().split())
	if z == x:
		print(0)
	else:
		s = abs(z - x)
		if s % 10 == 0:
			print(s // 10)
		else:
			print(s // 10 + 1)


import sys
import math
import collections
import bisect
import itertools
import decimal
import copy
INF = 10 ** 20
ni = lambda : int(sys.stdin.readline().rstrip())
ns = lambda : map(int, sys.stdin.readline().rstrip().split())
na = lambda : list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda : list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))

def main():
	t = ni()
	for _ in range(t):
		(a, b) = ns()
		ans = abs(b - a) // 10
		tmp = 1 if abs(b - a) % 10 else 0
		print(ans + tmp)
main()


t = int(input())
for k in range(t):
	s = input()
	l = s.split()
	a = int(l[0])
	b = int(l[1])
	c = 0
	if a < b and b - a > 0:
		d = b - a
		c = d // 10
		if d % 10 != 0:
			c = c + 1
	if b < a and a - b > 0:
		d = a - b
		c = d // 10
		if d % 10 != 0:
			c = c + 1
	print(c)


from collections import defaultdict as dd, deque
from sys import stdin
input = stdin.readline
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	ans = abs(a - b)
	ans1 = ans // 10
	ans2 = ans - ans // 10 * 10
	ans = ans // 10 + (ans - ans // 10 * 10) % 10
	if ans2:
		print(ans1 + 1)
	else:
		print(ans1)


for _ in range(int(input())):
	(a1, a2) = map(int, input().split())
	s = abs(a1 - a2)
	an = s // 10
	if s % 10 != 0:
		an = an + 1
	print(an)


t = int(input())
for case in range(t):
	(a, b) = [int(s) for s in input().split(' ')]
	if a == b:
		answer = 0
	elif b > a and (b - a) % 2 == 1:
		answer = 1
	elif a > b and (b - a) % 2 == 0:
		answer = 1
	else:
		answer = 2
	print(answer)


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


n = int(input())
Result = []
for i in range(0, n):
	list_ = list(map(int, input().strip().split()))[:2]
	a = list_[0]
	b = list_[1]
	x = b - a
	if x < 0:
		x = x * -1
		if x % 2 is 0:
			Result.append(1)
		else:
			Result.append(2)
	elif x > 0:
		if x % 2 is 1:
			Result.append(1)
		else:
			Result.append(2)
	else:
		Result.append(0)
for i in Result:
	print(i)


def solve(a, b):
	if a == b:
		return 0
	if a > b:
		d = a - b
		if d % 2 == 1:
			return 2
		return 1
	d = b - a
	if d % 2 == 1:
		return 1
	return 2

def main():
	inp = lambda : [int(x) for x in input().split()]
	tc = int(input())
	for _ in range(tc):
		(a, b) = inp()
		print(solve(a, b))
main()


def aoes(a, b):
	if a == b:
		print(0)
		return
	elif a > b:
		if b % 2 == 0 and a % 2 == 1:
			print(2)
		elif b % 2 == 0 and a % 2 == 0:
			print(1)
		elif b % 2 == 1 and a % 2 == 1:
			print(1)
		else:
			print(2)
		return
	elif a % 2 == 1 and b % 2 == 1:
		print(2)
	elif b % 2 == 0 and a % 2 == 0:
		print(2)
	else:
		print(1)
	return
n = int(input())
for i in range(n):
	t = input()
	l = list(map(int, t.split(' ')))
	aoes(l[0], l[1])


def do(a, b):
	bigSteps = abs(b - a) // 10
	ad = a % 10
	bd = b % 10
	smallSteps = abs(ad - bd) // 10
	print(bigSteps + smallSteps + int(ad - bd != 0))
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	do(a, b)


for _ in [0] * int(input()):
	(a, b) = map(int, input().split())
	b -= a
	print(b and 2 - ((b > 0) & b | (b < 0) & ~b))


def move(a, b):
	moves = abs(a - b) // 10
	return moves if a % 10 == b % 10 else moves + 1
n = int(input())
for _ in range(n):
	(a, b) = list(map(int, input().split(' ')))
	print(move(a, b))


a = int(input())
h = []
for i in range(0, a):
	(x, y) = list(map(int, input().split()))
	g = abs(x - y)
	k = (g + 9) // 10
	h.append(k)
print(*h, sep='\n')


n = int(input())
for q in range(n):
	(a, b) = [int(x) for x in input().split()]
	t = abs(b - a)
	print(t // 10 + (t % 10 > 0))


import math
for cases in range(int(input())):
	(n, m) = map(int, input().split())
	print(math.ceil(abs(n - m) / 10))


import math
T = int(input())
while T:
	T -= 1
	(a, b) = [int(x) for x in input().split()]
	diff = abs(b - a)
	ans = math.ceil(diff / 10)
	print(ans)


T = eval(input())
for t in range(T):
	(a, b) = [eval(n) for n in input().split()]
	diff = a - b
	if diff == 0:
		print(0)
	elif a > b:
		if diff % 2 == 0:
			print(1)
		else:
			print(2)
	elif diff % 2 == 0:
		print(2)
	else:
		print(1)


def solve(a1, b1):
	ans = 0
	a = max(a1, b1)
	b = min(a1, b1)
	if (a - b) % 10 != 0:
		ans += 1
	print((a - b) // 10 + ans)
for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	solve(a, b)


import sys
input = sys.stdin.readline
t = int(input())
for tt in range(t):
	(a, b) = map(int, input().split())
	print((abs(a - b) + 9) // 10)


T = int(input())
for _ in range(T):
	(a, b) = [int(x) for x in input().split()]
	print((abs(b - a) + 9) // 10)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	j = abs(k - n) + 9
	print(j // 10)


def answer():
	n = int(input())
	c_out = []
	while n:
		c = input().split()
		c = [int(x) for x in c]
		a = c[0]
		b = c[1]
		done = 0
		if b == a:
			done = 1
			c_out.append(0)
		if not done:
			if a % 2:
				if b % 2 and b < a:
					c_out.append(1)
				elif not b % 2 and b < a:
					c_out.append(2)
				elif b % 2 and b > a:
					c_out.append(2)
				else:
					c_out.append(1)
			elif b % 2 and b < a:
				c_out.append(2)
			elif not b % 2 and b < a:
				c_out.append(1)
			elif b % 2 and b > a:
				c_out.append(1)
			else:
				c_out.append(2)
		n -= 1
	for x in c_out:
		print(x)
answer()


for t in range(0, int(input())):
	(a, b) = map(int, input().strip().split())
	diff = abs(a - b)
	diff2 = diff / 10
	diff3 = diff // 10
	if diff2 - diff3 == 0:
		print(int(diff2))
	else:
		print(diff3 + 1)


n = int(input())
z = list()
a = 0
b = 0
m = 0
q = []
for x in range(n):
	y = str(input())
	z.append(y.split(' '))
	a = int(z[x][0])
	b = int(z[x][1])
	if a / b < 1:
		m = int((b - a) / 10)
		if (b - a) % 10 == 0:
			m += 0
		else:
			m += 1
	elif a / b > 1:
		m = int((a - b) / 10)
		if (a - b) % 10 == 0:
			m += 0
		else:
			m += 1
	else:
		m = 0
	q.append(m)
for x in q:
	print(x)


import sys
input = sys.stdin.buffer.readline

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

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
	return a
for __ in range(int(input())):
	(a, b) = I()
	diff = abs(a - b)
	ans = diff // 10
	if diff % 10:
		ans += 1
	print(ans)


t = int(input())
while t > 0:
	x = list(map(int, input().split()))
	a = x[0]
	b = x[1]
	c = abs(a - b)
	d = int(c / 10)
	e = c % 10
	if e == 0:
		print(d)
	else:
		print(d + 1)
	t -= 1


t = int(input())
w = []
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	c = max(a, b) - min(a, b)
	d = c // 10
	if c % 10 == 0:
		k = d
	else:
		k = d + 1
	w.append(k)
for i in w:
	print(i)


for _ in range(int(input())):
	x = input().split()
	a = int(x[0])
	b = int(x[1])
	print(int((abs(a - b) + 9) / 10))


def solve(x, y):
	if x == y:
		print(0)
		return
	if y > x:
		if x % 2 == 0:
			if y % 2 == 0:
				print(2)
			else:
				print(1)
		elif y % 2 == 0:
			print(1)
		else:
			print(2)
	elif (x - y) % 2 == 0:
		print(1)
	else:
		print(2)

def main():
	for i in range(int(input())):
		g = [int(x) for x in input().split()]
		solve(g[0], g[1])
main()


from sys import stdin, stdout
from collections import Counter, deque
import math
cin = stdin.readline
cout = stdout.write

def inpn():
	return int(cin())

def inpl():
	return list(map(int, cin().split()))

def inps():
	return cin()[:-1]

def inpv():
	return map(int, cin().split())

def outs(s):
	cout(s)

def outn(n):
	cout(str(n))

def outl(l):
	for i in l:
		cout(str(i) + ' ')

def outb(s):
	cout(str(s))
for _ in range(inpn()):
	(a, b) = inpv()
	x = abs(a - b)
	if x % 10 == 0:
		outn(x // 10)
		cout('\n')
	else:
		outn(x // 10 + 1)
		cout('\n')


t = int(input())
l1 = []
while t != 0:
	(a, b) = map(int, input().split())
	req = abs(b - a)
	if req > 0:
		rem = req % 10
		req = req // 10
		if rem > 0:
			print(req + 1)
		else:
			print(req)
	else:
		print(0)
	t -= 1


t = int(input())
for cas in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	ret = (b - a + 9) // 10
	print(ret)


t = int(input())
for u in range(t):
	temp = list(map(int, input().rstrip().split()))
	a = temp[0]
	b = temp[1]
	x = b - a
	if x % 2 == 0 and x > 0:
		print(2)
	elif x % 2 != 0 and x > 0:
		print(1)
	elif x % 2 == 0 and x < 0:
		print(1)
	elif x % 2 != 0 and x < 0:
		print(2)
	else:
		print(0)


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	v = (b - a) // 10
	if (b - a) % 10 != 0:
		v = v + 1
	print(v)


T = int(input())
for t in range(T):
	(a, b) = [int(s) for s in input().split()]
	Y = abs(b - a)
	ans = Y // 10 + (Y % 10 > 0)
	print(ans)


import math
t = int(input())
for _ in range(t):
	(a, b) = tuple([int(i) for i in input().split()])
	v = abs(b - a)
	print(math.ceil(v / 10))


import sys
si = sys.stdin.readline

def main():
	t = int(si())
	while t:
		t -= 1
		[a, b] = [int(e) for e in si().split()]
		temp = abs(a - b)
		q = temp // 10
		r = temp % 10
		if not r:
			print(q)
		else:
			print(q + 1)
main()


from collections import Counter
tst = int(input())
t = 1
while t <= tst:
	(a, b) = map(int, input().split())
	x = abs(a - b)
	i = 10
	mn = 100000000
	while i >= 10:
		p = int(x / i)
		q = x % i
		if q == 0:
			mn = min(p, mn)
		else:
			mn = min(p + 1, mn)
		i -= 1
	print(mn)
	t += 1


n = int(input())
cc = []
for i in range(n):
	s = 0
	n2 = input()
	n2 = n2.split()
	a = int(n2[0])
	b = int(n2[1])
	if a <= b:
		if a == b:
			s = 0
		elif (b - a) % 2 != 0:
			s = 1
		else:
			s = 2
	elif (a - b) % 2 != 0:
		s = 2
	else:
		s = 1
	cc.append(s)
for i in range(n):
	print(cc[i])


def calc(a, b):
	if a == b:
		return 0
	elif a < b:
		if (b - a) % 2 == 1:
			return 1
		else:
			return 2
	elif (a - b) % 2 == 0:
		return 1
	else:
		return 2
kk = int(input())
for _ in range(kk):
	(a, b) = map(int, input().split())
	print(calc(a, b))


import sys, math, heapq, collections, itertools, bisect
sys.setrecursionlimit(101000)

def solve(a, b):
	diff = abs(a - b)
	(u, l) = divmod(diff, 10)
	return u + int(l > 0)
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	print(solve(a, b))


t = int(input())
for i in range(t):
	k = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
	(a, b) = [int(i) for i in input().split()]
	c = 0
	if a == b:
		print(0)
	else:
		remain = abs(b - a)
		z = remain
		remain = remain // 10
		if z <= 10:
			print(1)
		elif z % 10 == 0:
			print(remain)
		else:
			print(remain + 1)


def pros(x, y):
	sum_arr = x + y
	if x < y:
		if sum_arr % 2 == 0:
			return 2
		else:
			return 1
	elif y < x:
		if sum_arr % 2 == 0:
			return 1
		else:
			return 2
	else:
		return 0
t = int(input())
for i in range(t):
	n = list(map(int, input().strip().split()))[:2]
	a = n[0]
	b = n[1]
	result = pros(a, b)
	print(result)


t = int(input())
arr = []
for i in range(t):
	(a, b) = map(int, input().split())
	temp = abs(a - b)
	if temp % 10 == 0:
		arr.append(str(temp // 10))
	else:
		arr.append(str(temp // 10 + 1))
print('\n'.join(arr))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(d, p) = divmod(abs(b - a), 10)
	print(d if p == 0 else d + 1)


n = int(input())
for i in range(n):
	(a, b) = sorted(map(int, input().split()))
	print((b - a - 1) // 10 + 1, end='\n')


n = int(input())
for __ in range(n):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	if a == b:
		print(0)
		continue
	elif b < a:
		(a, b) = (b, a)
	difference = b - a
	moves = difference // 10
	if difference % 10:
		moves += 1
	print(moves)


t = int(input())
li = []
for i in range(t):
	li.append(list(map(int, input().split())))
for i in range(t):
	if li[i][0] == li[i][1]:
		print('0')
	elif li[i][0] > li[i][1]:
		diff = li[i][0] - li[i][1]
		if diff % 2 == 0:
			print('1')
		else:
			print('2')
	else:
		diff = li[i][1] - li[i][0]
		if diff % 2 == 0:
			print('2')
		else:
			print('1')


import sys
t = int(sys.stdin.readline().strip())
for _ in range(t):
	(a, b) = map(int, sys.stdin.readline().strip().split())
	no = abs(b - a)
	m = no
	c = 10
	ans = 0
	while c >= 1 and m != 0:
		d = m // c
		m = m % c
		if d == 0:
			c -= 1
		ans += d
	print(ans)


tc = int(input())
for _ in range(tc):
	[a, b] = list(map(int, input().split()))
	if a > b:
		if (a - b) % 10 == 0:
			artir = 0
		else:
			artir = 1
		print((a - b) // 10 + artir)
	elif a < b:
		if (b - a) % 10 == 0:
			artir = 0
		else:
			artir = 1
		print((b - a) // 10 + artir)
	else:
		print(0)


from collections import Counter
from collections import defaultdict
import math
t = int(input())
for _ in range(0, t):
	(a, b) = list(map(int, input().split()))
	if a == b:
		print(0)
		continue
	if a < b:
		if b % 2 == 0 and a % 2 == 0 or (b % 2 != 0 and a % 2 != 0):
			print(2)
		else:
			print(1)
	elif b % 2 == 0 and a % 2 == 0 or (b % 2 != 0 and a % 2 != 0):
		print(1)
	else:
		print(2)


t = int(input())
test = [[i for i in map(int, input().split())] for x in range(t)]
i = 0

def g_check(a, b):
	if a == b:
		return 'esc'
	elif a > b:
		return True
	else:
		return False

def check(a):
	great = g_check(a[0], a[1])
	if great == 'esc':
		return 0
	elif great == True:
		if (a[0] - a[1]) % 2 == 0:
			return 1
		else:
			return 2
	elif (a[1] - a[0]) % 2 == 1:
		return 1
	else:
		return 2
while i < t:
	print(check(test[i]))
	i += 1


for T in range(int(input())):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	c = diff // 10 + (diff % 10 != 0)
	print(c)


a = int(input())
for i in range(a):
	str = input()
	a = str.split(sep=' ')
	(a[0], a[1]) = (int(a[0]), int(a[1]))
	result = abs(a[0] - a[1]) // 10
	if abs(a[0] - a[1]) % 10 != 0:
		result += 1
	print(result)


t = int(input())
cnt = 0
a = []
while cnt < t:
	b = input()
	c = b.split(' ')
	if int(c[0]) == int(c[1]):
		d = 0
		a.append(d)
		cnt += 1
	elif int(c[0]) < int(c[1]):
		if (int(c[1]) - int(c[0])) % 2 == 1:
			d = 1
			a.append(d)
			cnt += 1
		else:
			d = 2
			a.append(d)
			cnt += 1
	elif (int(c[0]) - int(c[1])) % 2 == 0:
		d = 1
		a.append(d)
		cnt += 1
	else:
		d = 2
		a.append(d)
		cnt += 1
i = 0
while i < t:
	print(a[i])
	i += 1


for i in range(int(input())):
	(a, b) = map(int, input().split())
	z = a - b
	c = z % 2 == 0 and z < 0 or (z % 2 == 1 and z > 0)
	c1 = z % 2 == 1 and z < 0 or (z > 0 and z % 2 == 0)
	if c:
		print(2)
	elif c1:
		print(1)
	else:
		print(0)


import sys
import math
from collections import defaultdict, Counter
input = sys.stdin.readline

def print(x):
	sys.stdout.write(str(x) + '\n')
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	ans = int(math.ceil(abs(a - b) / 10))
	print(ans)


t = int(input())
l1 = []
for i in range(0, t):
	l = list(map(int, input().split(' ')))
	l1.append(l)

def lol(a, b):
	if a > b:
		if (a - b) % 2 == 0:
			return 1
		elif (a - b) % 2 != 0:
			return 2
	elif b > a:
		if (b - a) % 2 == 0:
			return 2
		elif (b - a) % 2 != 0:
			return 1
	elif a == b:
		return 0
for i in range(0, t):
	print(lol(l1[i][0], l1[i][1]))


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	a = a - b
	sum = 1 if a % 10 else 0
	mn = 1
	while a != 0:
		a = a // 10
		b = a % 10
		sum += b * mn
		mn *= 10
	print(sum)


numCases = int(input())
for i in range(numCases):
	(a, b) = map(int, input().split(' '))
	dif = a - b
	if a % 2 == 1:
		isAodd = True
	if b % 2 == 1:
		isBodd = True
	if dif > 0:
		if dif % 2 == 0:
			print(1)
		else:
			print(2)
	elif dif < 0:
		if dif % 2 == 1:
			print(1)
		else:
			print(2)
	else:
		print(0)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a < b:
		x = b - a
		ans = x % 10
		ans1 = x // 10
		if ans != 0:
			ans1 = 1 + ans1
		else:
			ans1 = ans1
		print(ans1)
	elif b < a:
		ans = ans1
		x = a - b
		ans = x % 10
		ans1 = x // 10
		if ans != 0:
			ans1 = 1 + ans1
		else:
			ans1 = ans1
		print(ans1)
	else:
		print(0)


from math import *
from collections import *
t = int(input())
for y in range(t):
	(n, m) = map(int, input().split())
	if n == m:
		print(0)
	elif n > m:
		if n - m & 1:
			print(2)
		else:
			print(1)
	elif m - n & 1:
		print(1)
	else:
		print(2)


from collections import deque
import sys
input = sys.stdin.readline

def find(a, b):
	x = b - a
	if x < 0:
		x = -1 * x
	num1 = x // 10
	num2 = x % 10
	if num2 != 0:
		num1 += 1
	print(num1)
N = int(input())
for i in range(N):
	(a, b) = map(int, input().split())
	find(a, b)


def read_int():
	return int(input())

def read_ints():
	return map(int, input().split(' '))
t = read_int()
for case_num in range(t):
	(a, b) = read_ints()
	delta = abs(a - b)
	print(delta // 10 + (1 if delta % 10 != 0 else 0))


def solve():
	(a, b) = map(int, input().split())
	print(abs(a - b) // 10 + (abs(a - b) % 10 > 0))
for cnt in range(int(input())):
	solve()


n = int(input())
while n > 0:
	n -= 1
	(x, y) = map(int, input().split())
	temp = abs(x - y)
	if temp == 0:
		print('0')
		continue
	elif temp % 10 == 0:
		print(temp // 10)
	else:
		print(temp // 10 + 1)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	diff = abs(a - b)
	if b > a:
		if diff & 1 == 1:
			print(1)
		else:
			print(2)
	elif diff & 1 == 0:
		print(1)
	else:
		print(2)


for nt in range(int(input())):
	(a, b) = map(int, input().split())
	print((abs(b - a) - 1) // 10 + 1)


import sys
import math
import time
from functools import lru_cache
from collections import Counter
import heapq

def Update(X, AX, BX, CX, DX, k, n):
	for i in range(k, n):
		tem = (AX * X[i - 2] + BX * X[i - 1] + CX) % DX + 1
		X.append(tem)
try:
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		if n == k:
			print(0)
		else:
			d = abs(n - k)
			if d % 10 == 0:
				print(d // 10)
			else:
				print(d // 10 + 1)
except EOFError as e:
	print(e)


t = int(input())
arr = []
for i in range(t):
	arr.append(list(map(int, input().split())))

def solve(i):
	(a, b) = (i[0], i[1])
	if a > b:
		if (a - b) % 2 == 0:
			return 1
		else:
			return 2
	elif a < b:
		if (b - a) % 2 != 0:
			return 1
		else:
			return 2
	return 0
for i in arr:
	print(solve(i))


l = []
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		l.append(0)
		continue
	if b - a > 0 and (b - a) % 2 == 0 or (b - a < 0 and (b - a) % 2 != 0):
		l.append(2)
	else:
		l.append(1)
for i in l:
	print(i)


import sys
input = sys.stdin.readline

def getInt():
	return int(input())

def getVars():
	return 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)
	elif a % 2 == b % 2:
		print(2)
	else:
		print(1)


game = int(input())
for i in range(game):
	(a, b) = list(map(int, input().split()))
	if abs(a - b) % 10 == 0:
		print(int(abs(a - b) / 10))
	else:
		print(int(abs(a - b) / 10 + 1))


import sys
input = sys.stdin.readline
from math import ceil
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	print(int(ceil(abs(a - b) / 10)))


def cf():
	s = input().split()
	new_s = []
	for i in s:
		i = int(i)
		new_s.append(i)
	dif = abs(new_s[0] - new_s[1])
	if dif / 10 == dif // 10:
		print(dif // 10)
	else:
		print(dif // 10 + 1)
n = int(input())
for i in range(n):
	cf()


import math
t = int(input())
for i in range(0, t):
	(x, y) = input().split()
	print(math.ceil(abs(float(x) - float(y)) / 10))


from sys import *
n = lambda : map(int, stdin.readline().split())
t = [*n()][0]
while t > 0:
	(a, b) = [*n()]
	if a == b:
		print(0)
	elif a < b and (b - a) % 2 != 0:
		print(1)
	elif a > b and (b - a) % 2 == 0:
		print(1)
	else:
		print(2)
	t -= 1


from sys import stdin, stdout

def gmi():
	return map(int, stdin.readline().strip().split())

def gms():
	return map(str, stdin.readline().strip().split())

def gari():
	return list(map(int, stdin.readline().strip().split()))

def gars():
	return list(map(str, stdin.readline().strip().split()))

def gs():
	return stdin.readline().strip()

def gls():
	return list(stdin.readline())

def gi():
	return int(stdin.readline().strip())
t = gi()
while t:
	t -= 1
	(a, b) = gmi()
	ans = 0
	if b == a:
		print(0)
	elif (b - a) % 10:
		print(int(abs(b - a) // 10) + 1)
	else:
		print(int(abs(b - a) // 10))


import math
t = int(input())
while t:
	(a, b) = map(int, input().split())
	if a > b:
		c = (a - b) / 10
		d = math.floor(c)
		if not math.floor(c) == math.ceil(c):
			print(d + 1)
		else:
			print(d)
	else:
		c = (b - a) / 10
		d = math.floor(c)
		if not math.floor(c) == math.ceil(c):
			print(d + 1)
		else:
			print(d)
	t = t - 1


def func(n):
	for i in range(n):
		k = list(map(int, input().split()))
		a = k[0]
		b = k[1]
		if a == b:
			print(0)
		elif a > b and (a - b) % 2 == 0:
			print(1)
		elif a < b and (b - a) % 2 != 0:
			print(1)
		else:
			print(2)
n = int(input())
func(n)


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


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)
for xyz in range(0, int(input())):
	(a, b) = map(int, input().split())
	n = abs(a - b)
	if n == 0:
		print(0)
	else:
		ans = n // 10
		if n % 10 != 0:
			print(ans + 1)
		else:
			print(ans)


t = int(input())
k = 10
KOLVO = []
for i in range(t):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	n = 0
	if b > a:
		if b - k > a:
			n += (b - a) // k
			b = b - k * ((b - a) // k)
		if b > a:
			n += 1
	elif a > b:
		if a - k > b:
			n += (a - b) // k
			a = a - k * ((a - b) // k)
		if a > b:
			n += 1
	KOLVO.append(n)
for i in range(t):
	print(KOLVO[i])


t = int(input())
import math
for i in range(t):
	(n, q) = map(int, input().strip().split())
	if n == q:
		print(0)
	if q > n:
		if (q - n) % 2 != 0:
			print(1)
		else:
			print(2)
	if n > q:
		if (n - q) % 2 != 0:
			print(2)
		else:
			print(1)


import math
import re
import itertools
import copy
import time
import sys

def input_linear(lamb=lambda x: int(x), seperator=' '):
	return map(lamb, input().split(seperator))

def input_array(lamb=lambda x: int(x), seperator=' '):
	return list(map(lamb, input().split(seperator)))

def input_matrix(rows, lamb=lambda x: int(x), seperator=' '):
	tmp_matrix = []
	for i in range(rows):
		tmp_matrix.append(input_array(lamb, seperator))
	return tmp_matrix

def input_graph_al_pair(vertices, lines, lamb=lambda x: int(x), seperator=' ', directional=False, remove_dup=False):
	temp_matrix = [x[:] for x in [[]] * vertices]
	if not directional:
		if not remove_dup:
			for i in range(lines):
				(ina, inb) = input_linear(lamb, seperator)
				temp_matrix[ina].append(inb)
				temp_matrix[inb].append(ina)
		else:
			for i in range(lines):
				(ina, inb) = input_linear(lamb, seperator)
				if inb not in temp_matrix[ina]:
					temp_matrix[ina].append(inb)
				if ina not in temp_matrix[inb]:
					temp_matrix[inb].append(ina)
		return temp_matrix
	else:
		if not remove_dup:
			for i in range(lines):
				(ina, inb) = input_linear(lamb, seperator)
				temp_matrix[ina].append(inb)
		else:
			for i in range(lines):
				(ina, inb) = input_linear(lamb, seperator)
				if inb not in temp_matrix[ina]:
					temp_matrix[ina].append(inb)
		return temp_matrix
for _ in range(int(input())):
	(a, b) = input_linear()
	print(math.ceil(abs(b - a) / 10))


def main(i):
	a = i[0]
	b = i[1]
	diff = abs(a - b)
	if diff == 0:
		return 0
	elif diff % 10 == 0:
		return diff // 10
	else:
		return diff // 10 + 1
for _ in range(int(input())):
	print(main(list(map(int, input().split()))))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	oda = bool(a % 2)
	odb = bool(b % 2)
	ans = 1
	if a == b:
		ans = 0
	elif oda and odb:
		if a < b:
			ans = 2
		else:
			ans = 1
	elif not oda and (not odb):
		if a < b:
			ans = 2
		else:
			ans = 1
	elif oda and (not odb):
		if a < b:
			ans = 1
		else:
			ans = 2
	elif not oda and odb:
		if a > b:
			ans = 2
		else:
			ans = 1
	print(ans)


l = []
for i in range(int(input())):
	l.append(list(map(int, input().split())))
for i in range(len(l)):
	if l[i][1] > l[i][0]:
		if (l[i][1] - l[i][0]) % 2 == 0:
			print(2)
		else:
			print(1)
	elif l[i][0] == l[i][1]:
		print(0)
	elif (l[i][0] - l[i][1]) % 2 == 0:
		print(1)
	else:
		print(2)


import math
t = int(input())
A = []
for i in range(t):
	n = list(map(int, input().split()))
	A.append(math.ceil(abs(n[0] - n[1]) / 10))
for i in A:
	print(i)


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


n = int(input())
for i in range(n):
	x = [int(y) for y in input().split()]
	diff = x[0] - x[1]
	if diff == 0:
		print(0)
	elif diff > 0 and diff % 2 != 0 or (diff < 0 and diff % 2 == 0):
		print(2)
	else:
		print(1)


from math import *
t = int(input())
for cases in range(t):
	c = 0
	(a, b) = list(map(int, input().split()))
	if a == b:
		print('0')
	elif a < b:
		c = (b - a) / 10
		print(ceil(c))
	elif a > b:
		c = (a - b) / 10
		print(ceil(c))


t = int(input())
for i in range(t):
	ab = tuple(map(int, input().split()))
	ans = abs(ab[0] - ab[1]) / 10
	if ans.is_integer():
		print(int(ans))
	else:
		print(int(ans + 1))


import sys
import math

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
t = II()
for q in range(t):
	(a, b) = MI()
	print(math.ceil(abs(a - b) / 10))


t = int(input())
while t > 0:
	s = input()
	(a, b) = s.split(' ')
	a = int(a)
	b = int(b)
	diff = abs(a - b)
	if diff == 0:
		print(0)
	else:
		ans = diff // 10
		if diff % 10 != 0:
			ans += 1
		print(ans)
	t -= 1


a = int(input())
b = []
count = 0
for l in range(a):
	for i in input().split():
		b.append(int(i))
	dif = abs(b[0] - b[1])

	def cnt(dif):
		if dif % 10 != 0:
			dif -= dif % 10
			count = dif / 10 + 1
		else:
			count = dif / 10
		print(int(count))
	if b[0] == b[1]:
		print(0)
	else:
		cnt(dif)
	b.clear()


line = int(input())
time = 0
for count in range(line):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	c = 2 * b - (a + b)
	if c > 0:
		if c % 2 == 0:
			time = 2
		else:
			time = 1
	elif c == 0:
		time = 0
	elif -1 * c % 2 == 0:
		time = 1
	else:
		time = 2
	print(time)


from math import ceil
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	ans = diff / 10
	if diff % 10:
		ans += 1
	print(int(ans))


t = int(input())
for T in range(t):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	(a_, b_) = (a // 10, b // 10)
	(_a, _b) = (a % 10, b % 10)
	if a > b:
		print(a_ - b_ + (0 if _b >= _a else 1))
	elif b > a:
		print(b_ - a_ + (0 if _a >= _b else 1))
	else:
		print(0)


t = int(input())
for k in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		v = abs(a - b)
		d = v // 10
		r = v % 10
		if r == 0:
			print(d)
		else:
			print(d + 1)


for _ in range(int(input())):
	(a, b) = (int(i) for i in input().split())
	abs_difference = abs(a - b)
	k = 0
	if abs_difference % 10 != 0:
		k = 1
	print(abs_difference // 10 + k)


testcases = int(input())
for i in range(testcases):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	dif = abs(b - a)
	if dif % 10 == 0:
		print(int(dif / 10))
	else:
		val = int((dif - dif % 10) / 10) + 1
		print(val)


from math import ceil

def fun(a, b):
	i = max(a, b)
	j = min(a, b)
	c = i - j
	print(ceil(c / 10))
T = int(input())
for i in range(T):
	(a, b) = input().split()
	fun(int(a), int(b))


from sys import stdin
from math import ceil, gcd

def func():
	return
for _ in range(int(stdin.readline())):
	(a, b) = map(int, stdin.readline().split())
	if a < b:
		c = b - a
		if c % 10 == 0:
			print(c // 10)
		else:
			print(c // 10 + 1)
	elif a == b:
		print(0)
	else:
		c = a - b
		if c % 10 == 0:
			print(c // 10)
		else:
			print(c // 10 + 1)


from sys import stdin, stdout
import math
t = int(stdin.readline())
a = [0] * t
for i in range(0, t):
	a[i] = [int(x) for x in stdin.readline().split()]
	k = math.ceil(abs(a[i][0] - a[i][1]) / 10)
	print(str(k))


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	i = d // 10
	if d % 10 != 0:
		i += 1
	print(i)


t = int(input())
while t > 0:
	lis = list(map(int, input().split()))
	if lis[0] < lis[1]:
		if lis[0] % 2 == 0 and lis[1] % 2 == 0:
			print('2')
		elif lis[0] % 2 == 0 and lis[1] % 2 != 0 or (lis[0] % 2 != 0 and lis[1] % 2 == 0):
			print('1')
		elif lis[0] % 2 != 0 and lis[1] % 2 != 0:
			print('2')
	elif lis[0] > lis[1]:
		if lis[0] % 2 == 0 and lis[1] % 2 == 0:
			print('1')
		elif lis[0] % 2 == 0 and lis[1] % 2 != 0 or (lis[0] % 2 != 0 and lis[1] % 2 == 0):
			print('2')
		elif lis[0] % 2 != 0 and lis[1] % 2 != 0:
			print('1')
	else:
		print('0')
	t -= 1


t = int(input())
while t != 0:
	(x, y) = [int(k) for k in input().split()]
	diff = abs(x - y)
	count = 0
	count = int(diff / 10)
	if diff % 10 != 0:
		count += 1
	print(count)
	t -= 1


from collections import defaultdict as dc
import sys
import math
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif b > a:
		if (b - a) % 2:
			print(1)
		else:
			print(2)
	elif (a - b) % 2:
		print(2)
	else:
		print(1)


from math import gcd, ceil, log, floor
from collections import Counter, deque
from heapq import heappush, heappop, heapify

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

def arp(arr):
	return ''.join(arr)
for _ in range(int(input())):
	(a, b) = rl()
	if a == b:
		print(0)
	else:
		print(ceil(abs(a - b) / 10))


import math as m
t = int(input())
for _ in range(t):
	(a, b) = [int(x) for x in input().split()]
	print(m.ceil(abs(b - a) / 10))


n = int(input())
while n > 0:
	n -= 1
	a = input().split(' ')
	b = int(a[1])
	a = int(a[0])
	if a > b:
		c = a - b
	else:
		c = b - a
	if c % 10 > 0:
		print(int(c // 10 + 1))
	else:
		print(int(c // 10))


def solve(test):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	ans = (b - a + 9) // 10
	print(ans)
t = int(input())
for _ in range(t):
	solve(_ + 1)


import sys
import math
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(n,) = I()
while n:
	n -= 1
	(a, b) = I()
	if a == b:
		print(0)
	else:
		print(math.ceil(abs((a - b) / 10)))


def mine(a, b):
	cn = 0
	if a == b:
		pass
	elif abs(a - b) % 10 != 0:
		cn += abs(a - b) // 10 + 1
	else:
		cn += abs(a - b) // 10
	return cn
n = int(input())
val = []
for i in range(n):
	(a, b) = [int(j) for j in input().split(' ')]
	val.append(mine(a, b))
for i in range(n):
	print(val[i])


T = int(input())

def solve(a, b):
	count = 0
	while True:
		if a > b:
			if (a - b) % 2 == 0:
				count += 1
				return count
			else:
				a -= a - b + 1
				count += 1
		elif a < b:
			if (b - a) % 2 != 0:
				count += 1
				return count
			else:
				a += b - a - 1
				count += 1
		else:
			return count
out_li = []
for _ in range(T):
	a_b = list(map(int, input().split()))
	out_li.append(solve(a_b[0], a_b[1]))
for num in out_li:
	print(num)


import sys
first = int(sys.stdin.readline())
for i in range(first):
	(difference, sum, steps, temp) = (0, 0, 0, 0)
	(a, b) = map(int, sys.stdin.readline().split())
	if a < b:
		difference = b - a
		if difference % 2 == 0:
			difference = difference - 1
			temp = temp + 1
			a = a + difference + temp
			steps += 2
			print(steps)
		else:
			a = a + difference
			steps += 1
			print(steps)
	elif a > b:
		difference = a - b
		if difference % 2 == 0:
			a = a - difference
			steps += 1
			print(steps)
		else:
			difference = difference - 1
			temp = temp + 1
			a = a - difference - 1
			steps += 2
			print(steps)
	else:
		print(0)


t = int(input())
for c in range(t):
	z = str(input()).split()
	n = int(z[0])
	k = int(z[1])
	dif = k - n
	if dif == 0:
		print(0)
	elif dif > 0:
		if dif % 2 == 0:
			print(2)
		else:
			print(1)
	elif dif % 2 == 0:
		print(1)
	else:
		print(2)


cases = eval(input())
moves = 0
dist = 0
resto = 0
answ = []
for e in range(cases):
	integ = input()
	integ = [int(i) for i in integ.split()]
	dist = abs(integ[0] - integ[1])
	if dist != 0:
		moves += dist // 10
	if dist % 10 > 0:
		moves += 1
	answ.append(moves)
	moves = 0
for e in answ:
	print(e)


from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time

def I():
	return int(input())

def MI():
	return map(int, input().split())

def S():
	return input()

def MS():
	return map(str, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def StoI():
	return [ord(i) - 97 for i in input()]

def ItoS(nn):
	return chr(nn + 97)

def input():
	return sys.stdin.readline().rstrip()

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = {False: 'No', True: 'Yes'}
MOD = 10 ** 9 + 7
inf = float('inf')
IINF = 10 ** 10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False

def solve(T):
	(a, b) = MI()
	diff = b - a
	if diff == 0:
		print(0)
	elif diff > 0 and diff % 2 == 1:
		print(1)
	elif diff > 0 and diff % 2 == 0:
		print(2)
	elif diff < 0 and diff % 2 == 0:
		print(1)
	elif diff < 0 and diff % 2 == 1:
		print(2)

def main():
	T = I()
	for i in range(T):
		solve(T)
main()


for m in range(int(input())):
	ab = list(map(int, input().split()))
	mod = abs(ab[1] - ab[0])
	steps = 0
	for i in range(10, 0, -1):
		if mod == 0:
			break
		else:
			steps += mod // i
			mod -= mod // i * i
	print(steps)


def in1():
	return int(input())
for _ in range(in1()):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		if a > b:
			(a, b) = (b, a)
		t1 = b - a
		i = 10
		while t1 // i == 0 and i > 0:
			i -= 1
		t2 = t1 // i
		if t1 % i != 0:
			print(t2 + 1)
		else:
			print(t2)


t = int(input())
ans = []
is_even = lambda value: value % 2 == 0

def invert_if_true(what, condition):
	return not what if condition else what
ans = []
for i in range(t):
	(a, b) = [int(i) for i in input().split()]
	if b == a:
		ans.append(0)
		continue
	elif invert_if_true(is_even(b) == is_even(a), b > a):
		ans.append(1)
	else:
		ans.append(2)
for i in ans:
	print(i)


from sys import stdin, stdout

def main():
	nbre = int(stdin.readline().strip())
	for loop in range(nbre):
		(x, y) = list(map(int, stdin.readline().strip().split(' ')))
		diff = y - x
		if diff == 0:
			stdout.write('0\n')
			continue
		if diff > 0:
			if diff % 2 == 1:
				stdout.write('1\n')
				continue
			else:
				stdout.write('2\n')
				continue
		elif diff % 2 == 0:
			stdout.write('1\n')
			continue
		else:
			stdout.write('2\n')
			continue
main()


number_of_tests = int(input())
for i in range(number_of_tests):
	two_numbers = input()
	l = two_numbers.split(' ')
	if len(l) > 2:
		exit(0)
	for j in range(len(l)):
		l[j] = int(l[j])
	if l[0] < l[1]:
		if (l[1] - l[0]) % 2 == 0:
			print(2)
		else:
			print(1)
	elif l[0] > l[1]:
		if (l[0] - l[1]) % 2 == 0:
			print(1)
		else:
			print(2)
	else:
		print(0)


import sys

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

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def solve():
	(a, b) = mints()
	if a == b:
		print(0)
	elif a < b:
		if a % 2 == 1:
			if b % 2 == 0:
				print(1)
			else:
				print(2)
		elif b % 2 == 1:
			print(1)
		else:
			print(2)
	elif a % 2 == 1:
		if b % 2 == 1:
			print(1)
		else:
			print(2)
	elif b % 2 == 0:
		print(1)
	else:
		print(2)
for i in range(mint()):
	solve()


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)
	elif (b - a) % 2 == 1:
		print(1)
	else:
		print(2)
query_count = Read.int()
while query_count:
	query_count -= 1
	solve()


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
for case in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	diff = abs(b - a)
	ans = diff // 10 + int(bool(diff % 10))
	print(ans)


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	c = max(a, b)
	d = min(a, b)
	if c - d == 0:
		print(0)
	elif c - d <= 10:
		print(1)
	else:
		ans = 0
		e = c - d
		if e % 10 == 0:
			ans = e // 10
		else:
			ans += e // 10 + 1
		print(ans)


n = int(input())
for i in range(n):
	c = 0
	(a, b) = map(int, input().split())
	k = abs(a - b)
	if k == 0:
		print(c)
	elif k < 10 and k != 0:
		c = 1
		print(c)
	else:
		d = k // 10
		c = c + d
		r = k % 10
		if r != 0:
			c = c + 1
		print(c)


import math

def print_result(ans):
	print(ans)

def solve(a, b):
	return math.ceil(abs(a - b) / 10)
t = int(input())
for i in range(1, t + 1):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	ans = solve(a, b)
	print_result(ans)


import math

def function(a, b):
	if a == b:
		return 0
	if abs(a - b) <= 10:
		return 1
	if a < b:
		return math.ceil((b - a) / 10)
	if a > b:
		return math.ceil((a - b) / 10)
t = int(input())
for i in range(t):
	(a, b) = map(int, input().rstrip().split())
	print(function(a, b))


Test = int(input())
while Test > 0:
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a < b:
		x = b - a
		if x % 2 != 0:
			print(1)
		else:
			print(2)
	else:
		x = a - b
		if x % 2 == 0:
			print(1)
		else:
			print(2)
	Test -= 1


from math import *
from copy import *
from string import *
from random import *
from sys import stdin, stdout
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math
import math
import time
from queue import Queue

def seive(n):
	l = [True]
	l = l * (n + 1)
	for i in range(2, int(sqrt(n)) + 1):
		if l[i] == True:
			val = i * i
			while val < len(l):
				l[val] = False
				val += i
	prime = []
	for i in range(2, len(l)):
		if l[i] == True:
			prime.append(i)
	return prime

def dp(l, i, n, val, ans):
	if i >= n or val < 0:
		return 1000000
	elif val == 0:
		return 0
	else:
		if ans[i] == 1000000:
			ans[i] = min(min(1 + dp(l, i + 1, n, val - l[i], ans), 1 + dp(l, i, n, val - l[i], ans)), dp(l, i + 1, n, val, ans))
		return ans[i]
from queue import Queue

def factors(n):
	l = []
	for i in range(1, int(sqrt(n)) + 1):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def check1(s, v, x):
	while True:
		if v not in s:
			return v
		else:
			v -= 1

def check2(s, v, x):
	while True:
		if v not in s:
			return v
		else:
			v += 1

def up(n):
	j = n - 1
	while j > 0:
		if n % j == 0:
			break
		j -= 1
	return j

def fac(n):
	c = 1
	i = 1
	while i <= n:
		c *= i
		i += 1
	return c

def check_happy(n):
	ss = set()
	print(n)
	while n != 1:
		val = n
		s = 0
		print(val)
		while val != 0:
			s += (val % 10) ** 2
			val = val // 10
		print(val)
		print('hi')
		if val in ss:
			return False
		else:
			n = val
			ss.add(n)
	return True

def update(a, b):
	c = 1
	val = a
	while a < b:
		print(c, a)
		c += c
		a += a
	print(1)
	while a > b:
		print()
		a -= val
		c -= 1
	return c
import random as rand

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
from itertools import permutations

def insertion_sort(arr):
	for i in range(len(arr)):
		j = i
		while j > 0:
			if arr[j] < arr[j - 1]:
				temp = arr[j]
				arr[j] = arr[j - 1]
				arr[j - 1] = temp
			j -= 1
	return arr

def quick_sort(arr, low, high):
	i = low
	j = high
	while i < j:
		if arr[i] > arr[low] and arr[j] < arr[low]:
			temp = arr[i]
			arr[i] = arr[j]
			arr[j] = arr[i]
			i += 1
			j -= 1
		elif arr[i] <= arr[low]:
			i += 1
		elif arr[j] >= arr[low]:
			j -= 1
	print(i, j)
	toto = arr[j]
	arr[j] = arr[low]
	arr[low] = toto
	return j

def dodo(arr, low, high):
	if low < high:
		val = quick_sort(arr, low, high)
		dodo(arr, low, val - 1)
		dodo(arr, val + 1, high)

def dp(arr, c, n, k, z, ans):
	if k == 0:
		return ans
	elif c == 0:
		return dp(arr, c + 1, n, k - 1, z, ans + arr[c + 1])
	elif c == n - 1:
		if z == 0:
			return 0
		else:
			return dp(arr, c - 1, n, k - 1, z - 1, ans + arr[c - 1])
	elif z == 0:
		return dp(arr, c + 1, n, k - 1, z, ans + arr[c + 1])
	else:
		return max(dp(arr, c + 1, n, k - 1, z, ans + arr[c + 1]), dp(arr, c - 1, n, k - 1, z - 1, ans + arr[c - 1]))

def check(arr, val):
	a = -1
	for i in range(len(arr)):
		if arr[i][len(arr[i]) - 1] == val:
			a = i
			break
	return a

def reverse(s, i, ans):
	if i >= len(s):
		return ans
	else:
		return reverse(s, i + 1, s[i] + ans)

def update(arr, i, j, n, m):
	if i >= 0 and i < n and (j >= 0) and (j < m):
		if arr[i][j] == 1:
			arr[i][j] == 2
			return [i, j]
	return [-1, -1]

def mergesort(arr):
	n = len(arr)
	if n == 1:
		return arr
	else:
		n = n // 2
		a1 = arr[0:n]
		a2 = arr[n:len(arr)]
		l1 = mergesort(a1)
		l2 = mergesort(a2)
		return merge(l1, l2)

def merge(arr1, arr2):
	i1 = 0
	i2 = 0
	res = []
	n1 = len(arr1)
	n2 = len(arr2)
	while i1 < n1 and i2 < n2:
		if arr1[i1] <= arr2[i2]:
			res.append(arr1[i1])
			i1 += 1
		else:
			res.append(arr2[i2])
			i2 += 1
	while i1 < n1:
		res.append(arr1[i1])
		i1 += 1
	while i2 < n2:
		res.append(arr2[i2])
		i2 += 1
	return res

def mergeSort(arr):
	if len(arr) > 1:
		mid = len(arr) // 2
		L = arr[:mid]
		R = arr[mid:]
		mergeSort(L)
		mergeSort(R)
		i = j = k = 0
		while i < len(L) and j < len(R):
			if L[i] < R[j]:
				arr[k] = L[i]
				i += 1
			else:
				arr[k] = R[j]
				j += 1
			k += 1
		while i < len(L):
			arr[k] = L[i]
			i += 1
			k += 1
		while j < len(R):
			arr[k] = R[j]
			j += 1
			k += 1
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split(' '))
	val = abs(a - b)
	if val % 10 == 0:
		print(val // 10)
	else:
		print(val // 10 + 1)


import sys, math, cmath, time
start_time = time.time()

def solve():
	(a, b) = invr()
	print(math.ceil(abs(a - b) / 10))

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
		sys.stdout.close()

def inp():
	return int(input())

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

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def counter_elements(a):
	q = dict()
	for i in range(len(a)):
		if a[i] not in q:
			q[a[i]] = 0
		q[a[i]] = q[a[i]] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def prime_factors(n):
	q = []
	while n % 2 == 0:
		q.append(2)
		n = n // 2
	for i in range(3, int(n ** 0.5) + 1, 2):
		while n % i == 0:
			q.append(i)
			n = n // i
	if n > 2:
		q.append(n)
	return list(sorted(q))

def transpose(a):
	(n, m) = (len(a), len(a[0]))
	b = [[0] * n for i in range(m)]
	for i in range(m):
		for j in range(n):
			b[i][j] = a[j][i]
	return b

def factorial(n, m=1000000007):
	q = 1
	for i in range(n):
		q = q * (i + 1) % m
	return q
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


import math as m
t = int(input())
for _t in range(t):
	(a, b) = map(int, input().split())
	diff = m.ceil(abs(a - b) / 10)
	print(diff)


from math import ceil

def main():
	for test in range(int(input())):
		(a, b) = map(int, input().split())
		print(solution(a, b))

def solution(a, b):
	return ceil(abs(a - b) / 10)
main()


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
x = inp()
l = []
for i in range(x):
	(y, z) = invr()
	l.append(math.ceil(abs(y - z) / 10))
for i in l:
	print(i)


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


import sys, math, heapq, copy
from collections import defaultdict, deque
from bisect import bisect_left, bisect_right
from functools import cmp_to_key
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	print(math.ceil(d / 10))