Vasya likes the number $239$. Therefore, he considers a number pretty if its last digit is $2$, $3$ or $9$. 
Vasya wants to watch the numbers between $L$ and $R$ (both inclusive), so he asked you to determine how many pretty numbers are in this range. Can you help him?

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first and only line of each test case contains two space-separated integers $L$ and $R$.

-----Output-----
For each test case, print a single line containing one integer — the number of pretty numbers between $L$ and $R$.

-----Constraints-----
- $1 \le T \le 100$
- $1 \le L \le R \le 10^5$

-----Subtasks-----
Subtask #1 (100 points): original constraints

-----Example Input-----
2
1 10
11 33

-----Example Output-----
3
8

-----Explanation-----
Example case 1: The pretty numbers between $1$ and $10$ are $2$, $3$ and $9$.
Example case 2: The pretty numbers between $11$ and $33$ are $12$, $13$, $19$, $22$, $23$, $29$, $32$ and $33$.

Starter code:

Solutions:
# cook your dish here
t=int(input())
for _ in range(t):
 n,m = map(int,input().split())
 count=0
 for i in range(n,m+1):
  p=str(i)
  if p[-1]=='2' or p[-1]=='3' or p[-1]=='9':
   count+=1
 print(count)

# cook your dish here
t=int(input())
for i in range(t):
 l,r=list(map(int,input().split()))
 ans=0

 for i in range(l,r+1):
  ck=i%10
  if(ck==2 or ck==3 or ck==9):
   ans+=1

 print(ans)


# cook your dish here
t=int(input())
for i in range(t):
 l,r=list(map(int,input().split()))
 ans=0

 for i in range(l,r+1):
  ck=str(i)[-1]
  if(ck=='2' or ck=='3' or ck=='9'):
   ans+=1

 print(ans)


# cook your dish here
z=int(input())

for i in range(z):
 l,r = map(int, input().split())
 count=0
 for i in range(l,r+1):
  
  if i%10 in [2,3,9]:
   count+=1
  
 print(count)

# cook your dish here
for i in range(int(input())):
 c=0
 a,b=map(int,input().split())
 for j in range(a,b+1):
  k=j%10
  if k==2 or k==3 or k==9:
   c=c+1
 print(c)

for x in range(int(input())):
 l,r=map(int,input().split())
 c=0
 if l-r<=0:
  for y in range(l,r+1):
   if y%10 in [2,3,9]:
    c+=1
 else:
  c=3*(r//10-l//10)
  for y in range(l%10):
   if y in [2,3,9]:
    c-=1
  for y in range(r%10):
   if y in [2,3,9]:
    c+=1
 print(c)

# cook your dish here
z=int(input())

for i in range(z):
 l,r = map(int, input().split())
 count=0
 for i in range(l,r+1):
  
  if i%10 in [2,3,9]:
   count+=1
  
 print(count)

# cook your dish here
# python programs by sourav


for _ in range(int(input())):
 l,r=map(int,input().split())

 c=0
 while l<=r:
  i=1
  if str(l)[-1]=='2':
   c+=1
   i=1
  elif str(l)[-1]=='3':
   c+=1
   i=6
  elif str(l)[-1]=='9':
   c+=1
   i=3
  l+=i
 print(c)

# cook your dish here
for x in range(int(input())):
 l,r=list(map(int,input().split()))
 c=0
 if l-r<=0:
  for y in range(l,r+1):
   if y%10 in [2,3,9]:
    c+=1
 else:
  c=3*(r//10-l//10)
  for y in range(l%10):
   if y in [2,3,9]:
    c-=1
  for y in range(r%10):
   if y in [2,3,9]:
    c+=1
 print(c)
   


t=int(input())
for j in range(t):
 l,r=list(map(int,input().split()))
 c=0
 for i in range(l,(r+1)):
  if ((i%10)==2) or ((i%10)==3) or ((i%10)==9):
   c+=1
 print(c) 


# cook your dish here
t=int(input())
for i in range(t):
 a,b=map(int,input().split())
 c=[2,3,9]
 d=0
 for j in range(a,b+1):
  if(j%10 in c):
   d=d+1
 print(d)

t= int(input())
while t:
 l,r=input().split()
 l=int(l)
 r=int(r) 
 count=0
 for i in range(l,r+1):
  rem = i%10
  if rem ==2 or rem == 3 or rem == 9 :
   count=count+1
 print(count)
 t=t-1


# cook your dish here
def prettynumber(m,n):
 count = 0
 for i in range(m, n + 1):
  x = i % 10
  if (x == 2 or x == 3 or x == 9):
   count += 1
 print(count)

def __starting_point():
 for j in range(int(input())):
  ab = input().split()
  a = int(ab[0])
  b = int(ab[1])
  prettynumber(a,b)

__starting_point()

# cook your dish here
n = int(input())
for _ in range(n):
 arr = list(map(int, input().split()))
 a = [2,3,9]
 count=0
 for i in range(arr[0], arr[-1]+1):
  if i%10 in a:
   count+=1
 print(count)

for _ in range(int(input())):
 L, R = map(int, input().split())
 count = 0
 for i in range(L, R+1):
  if str(i)[-1] in ['2','3','9']:
   count += 1 
 print(count)

t = int(input())
while t>0:
 l,r = tuple([int(i) for i in input().split()])
 c = 0
 for i in range(l,r+1):
  num = list(str(i))[-1]
  if '2' == num or '3' == num or '9' == num:
   #print(i)
   c+=1
 print(c)
 t-=1



# cook your dish here
x = int(input())

lst = []

for i in range(0, x):
 l , r = input().split()
 l = int(l)
 r = int(r)
 sublst = []
 while l<=r:
  if l%10 == 2 or l%10 == 3 or l%10 == 9:
   sublst.append(l)
  l+=1
 lst.append(len(sublst))

for i in range(0,x):
 print(lst[i])


# cook your dish here
T = int(input())
for j in range(T):
 ran = list(map(int, input().rstrip().split()))
 count=0
 for i in range(ran[0],ran[1]+1):
  if(i%10==2 or i%10 == 3 or i%10 == 9):
   count+=1
 print(count)

# cook your dish here
for i in range(int(input())):
 m,n = map(int,input().split())
 c = 0
 for i in range(m,n+1):
  p = str(i)
  if(p[-1] == "2" or p[-1] == "3" or p[-1] == "9"):
   c = c+1
 print(c)

# cook your dish here
def __starting_point():
 t=int(input())
 for m in range(t):
  l,r=list(map(int, input().split(" ")))
  co=0
  for i in range(l,r+1):
   if(i%10 == 2 or i%10==3 or i%10 == 9):
    co+=1
  print(co)
def pretty(n):
 if(n%10 == 2 or n%10==3 or n%10 == 9):
  return True
 else:
  return False
__starting_point()

def __starting_point():
 t=int(input())
 for m in range(t):
  l,r=list(map(int, input().split(" ")))
  co=0
  for i in range(l,r+1):
   if(i%10 == 2 or i%10==3 or i%10 == 9):
    co+=1
  print(co)
def pretty(n):
 if(n%10 == 2 or n%10==3 or n%10 == 9):
  return True
 else:
  return False
__starting_point()

# cook your dish here
for i in range(int(input())):
 m,n = list(map(int,input().split()))
 c = 0
 for i in range(m,n+1):
  p = str(i)
  if(p[-1] == "2" or p[-1] == "3" or p[-1] == "9"):
   c = c+1
 print(c)
 


# cook your dish here
for _ in range(int(input())):
 l,r = map(int,input().split())
 c = 0
 for i in range(l,r+1):
  if str(i)[-1] in '239':
   c += 1
 print(c)

# cook your dish here
t=int(input())
for i in range(t):
 c=0
 l,r=list(map(int,input().split()))
 #print(c)
 for i in range(l,r+1,1):
  if(i%10==2 or i%10==3 or i%10==9):
   c+=1
 print(c)
   


# cook your dish here
for j in range(int(input())):
 count=0
 l,r=map(int,input().split())
 for i in range(l,r+1,1):
  a=str(i)
  if a[-1]=="2" or a[-1]=="3" or a[-1]=="9":
   count+=1
 print(count)