# HackerEarth Friendless Dr. Sheldon Cooper problem solution

In this HackerEarth Friendless Dr. Sheldon Cooper problem solution Leonard has decided to quit living with Dr. Sheldon Cooper and has started to live with Penny. Yes, you read it right. (And you read it here for the first time!) He is fed up of Sheldon, after all. Since, Sheldon no more has Leonard to drive him all around the city for various things, he's feeling a lot uneasy so he decides to set up a network of drivers all around the city to drive him to various places.

But, not every driver wants to go every place in the city for various personal reasons, so Sheldon needs to trust many different cab drivers. (Which is a very serious issue for him, by the way!) The problem occurs mainly when Sheldon needs to go to - for example, the Comic book store - and there's no cab driver who goes directly to that place. So, he has to take a cab till another place, and then take a cab from there - making him more scared!

Sheldon wants to limit his trust issues. Really. Once. And. For. All.

Let's say that you're given the schedule of all the cabs from the major points where he travels to and from - can you help Sheldon figure out the least number of cab drivers he needs to trust, in order to go to all the places he wants to?

## HackerEarth Friendless Dr. Sheldon Cooper problem solution.

`tc = int(raw_input())while (tc>0):  tc = tc - 1  a, b = map(int, raw_input().split())  while (b>0):    b = b - 1    m, n = map(int, raw_input().split())  print a-1  `

### Second solution

`for _ in xrange(input()):  a,b=map(int,raw_input().split())  for __ in xrange(b):    raw_input()  print a-1`