We all know that Share market is place where drastic change occurs within moments. So we have one Stockholder, Isabella, who wants to maximize her profit by selling her shares. She has $N$ shares of a Doofenshmirtz Corporation which is represented by $N$ different lines where each line contains two space separated integers $a_i$ , $b_i$ corresponding to initial and final values of the share prize. Isabella can sell any number of shares. But, she will sell those shares only if the following condition is satisfied - 
- for any pair $(i,j)$ of shares that she choses to sell, $a_i \leq a_j$  and $b_i < b_j$ must be satisfied. 
You need to tell Isabella the maximum number of Shares she can sell.

-----Input:-----
- First line will contain $T$, number of test cases. 
- Each test case has the following format:
- First line of each test case contain single integer $N$, the number of shares of Isabella.  
- Next $N$ lines of each test case contain two space separated integers $a_i$, $b_i$ (initial and final value of share prize respectively) for each $1 \leq i \leq N$.

-----Output:-----
For each test case output a single integer: the maximum number of shares that can be sold by Isabella.

-----Constraints-----
- $1 \leq T \leq 5$
- $1 \leq N \leq 10^5$
- $1 \leq a_i , b_i \leq 10^9 , for  each $1$ \leq $i$ \leq $N 

-----Sample Input:-----
$1$
$4$ 
$1$ $2$
$4$ $3$
$3$ $5$ 
$2$ $4$ 

-----Sample Output:-----
$3$   

-----Explanation:-----
Here, Isabella decided to sell share 1, share 3 and share 4 as any two pair of 
chosen share hold the given condition.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = '# cook your dish here\ndef CeilIndex(A, l, r, key): \n\n\twhile (r - l > 1): \n\t\n\t\tm = l + (r - l)//2\n\t\tif (A[m] >= key): \n\t\t\tr = m \n\t\telse: \n\t\t\tl = m \n\treturn r \n\ndef LongestIncreasingSubsequenceLength(A, size): \n\n\t# Add boundary case, \n\t# when array size is one \n\n\ttailTable = [0 for i in range(size + 1)] \n\tlen = 0 # always points empty slot \n\n\ttailTable[0] = A[0] \n\tlen = 1\n\tfor i in range(1, size): \n\t\n\t\tif (A[i] < tailTable[0]): \n\n\t\t\t# new smallest value \n\t\t\ttailTable[0] = A[i] \n\n\t\telif (A[i] > tailTable[len-1]): \n\n\t\t\t# A[i] wants to extend \n\t\t\t# largest subsequence \n\t\t\ttailTable[len] = A[i] \n\t\t\tlen+= 1\n\n\t\telse: \n\t\t\t# A[i] wants to be current \n\t\t\t# end candidate of an existing \n\t\t\t# subsequence. It will replace \n\t\t\t# ceil value in tailTable \n\t\t\ttailTable[CeilIndex(tailTable, -1, len-1, A[i])] = A[i] \n\t\t\n\n\treturn len\n\nfor _ in range(int(input())):\n    t = int(input())\n    l = []\n    for _ in range(t):\n        (x,y) = map(int,input().split())\n        l.append([x,y])\n    l.sort()\n    # print(l)\n    kk = []\n    for (i,j) in l:\n        kk.append(j)\n    print(LongestIncreasingSubsequenceLength(kk, t))    '
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13451