N one dimensional kingdoms are represented as intervals of the form [ai , bi] on the real line.
A kingdom of the form [L, R] can be destroyed completely by placing a bomb at a point x on the real line if L
≤ x ≤ R.


Your task is to determine minimum number of bombs required to destroy all the one dimensional kingdoms.

Input


First line of the input contains T denoting number of test cases.


For each test case, first line contains N denoting the number of one dimensional kingdoms.


For each next N lines, each line contains two space separated integers ai and bi.



Output
For each test case , output an integer denoting the minimum  number of bombs required.

Constraints
Example
Input:
1
3
1 3
2 5
6 9

Output:
2

Explanation
There are three kingdoms [1,3] ,[2,5] and [6,9]. You will need at least 2 bombs
to destroy the kingdoms. In one of the possible solutions, you can place two bombs at x = 2 and x = 6 .
import math
def parseIntList(str):
 return [long(x) for x in str.split()]
def printBS(li):
 s=[str(i) for i in li]
 print " ".join(s)
def intersection(a,b):
 if a[0]<=b[0]<=a[1]<=b[1]:
  return (b[0],a[1])
 elif a[0]<=b[0]<=b[1]<=a[1]:
  return b
 return None
cases=input()
for case in range(cases):
 li=[]
 n=input()
 for i in range(n):
  li.append(tuple(parseIntList(raw_input())))
 li.sort()
 res=[]
 temp=li[0]
 for i in range(1,n):
  inter=intersection(temp,li[i])
  if inter:
   temp=inter
  else:
   res.append(temp)
   temp=li[i]
 res.append(temp)
 #print res
 print len(res)