There is a city with $N$ numbered $0 - N-1$ shops. A market is a place where we can reach from one shop to another using some road. There are $M$ roads in this city connecting each connecting any two shops. 
Find the number of markets in the city.
NOTE:  A market having only one shop is also a valid market.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- First line of Each Test Case is $N, M$, denoting the number of shops and the number of roads respectively.
- Next M lines consist of two integers $A$ and $B$ denoting that there exists a road between Shop A and Shop B

-----Output:-----
For each testcase, output the number of markets.

-----Constraints-----
- $1 \leq T \leq 100$
- $1 \leq N,M \leq 10^3$
- $0 \leq A,B < N$

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

-----Sample Output:-----
2

```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 = '# Python3 program to print DFS traversal\n# from a given given graph\nfrom collections import defaultdict\n\nviz = [0]*1005\n# This class represents a directed graph using\n# adjacency list representation\n\n\nclass Graph:\n\n    # Constructor\n    def __init__(self):\n\n        # default dictionary to store graph\n        self.graph = defaultdict(list)\n\n    # function to add an edge to graph\n    def addEdge(self, u, v):\n        self.graph[u].append(v)\n\n    # A function used by DFS\n    def DFSUtil(self, v, visited):\n        nonlocal viz\n        # Mark the current node as visited\n        # and print it\n        visited[v] = True\n        viz[v]=1\n        # print(v, end=\' \')\n\n        # Recur for all the vertices\n        # adjacent to this vertex\n        for i in self.graph[v]:\n            if visited[i] == False:\n                self.DFSUtil(i, visited)\n\n    # The function to do DFS traversal. It uses\n    # recursive DFSUtil()\n    def DFS(self, v,visited):\n\n        # Mark all the vertices as not visited\n        # visited = [False] * (max(self.graph)+1)\n\n        # Call the recursive helper function\n        # to print DFS traversal\n        self.DFSUtil(v, visited)\n\n        return visited\n\n# Driver code\n\n\n# Create a graph given\n# in the above diagram\nfor _ in range(int(input())):\n    \n    g = Graph()\n    n, m = list(map(int, input().split()))\n    vizi=[False]*(n+1)\n    for i in range(m):\n        a, b = list(map(int, input().split()))\n        g.addEdge(a, b)\n        g.addEdge(b, a)\n\n    cnt = 0\n    for i in range(n):\n        if vizi[i] == False:\n            cnt += 1\n            vizi=g.DFS(i,vizi)\n\n    print(cnt)\n\n# print("Following is DFS from (starting from vertex 2)")\n# g.DFS(2)\n\n# This code is contributed by Neelam Yadav\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: