The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 6 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Note: Every where quotes are used just for clarity.
Please always Ignore them except when mentioned explicitly.
There are N students and one teacher(name: Bhoondu) in a college.
Each student is identified by his number K ( 1KN).
Some of them are friends of each others.
Friendship relation is equivalence relation, means:
Some other information about the students is that:
One student S out of these students(1,2,... N) has done a mistake.
And one another student K somehow came to know about S's mistake. S DON'T know who is K.
Now you have to help S to find out the maximum possible threat to him.
Threat is defined as how many students has complained about S to Bhoondu.
You are also given information about friendship of students in college.
It will be given as pairs "A B" which means A is friend of B.
Note that some information given to you may be redundant.
First line will contain the number of test cases T.
For each test case the first line will contain N S and F separated by space.
Where N is the number of students, S is the student who made the mistake and
F is the number of friendship information given to you.
After this next F lines will contain two numbers A and B separated by space.
There is no empty line between different test cases.
For each test case the output will be an integer in a new line, which will be the maximum threat for S in the corresponding test case.
Explanation:
In 1st test case:
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll