Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 398 Weeks Ago, 2 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 16 Sep 2017 My Price 7.00

Suruchi's friend

Suruchi's friend arrived to her state and called her up.She became very happy and wanted to meet her as soon as possible. But her friend arrived in city B while Suruchi lived in city A. Suruchi's state have N cities and any two city that are connected are bidirectional and have the same distance. She wants to reach her friend as soon as possible so she wants your help in finding out the smallest distance possible.

Capital of city is always numbered 1.

Input

  • The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
  • The first line of each test case contains three space-separated integers N A B denoting number of cities in her state , Suruchi's city and her friend's city respectively.
  • Next N-1 lines show the connection between the cities.

Output

Print the shortest distance between city A and city B.

Constraints

  • 1 = T = 100
  • 1 = A = 100
  • 1 = B = 100

Example

Input: 1 15 2 7 1 2 1 3 2 4 2 5 3 6 3 7 4 8 4 9 5 10 5 11 6 12 6 13 7 14 7 15 Output: 3

Explanation

Example case 1. She travels 2->1,1->3,3->7. Therefore answer is 3

Answers

(5)
Status NEW Posted 16 Sep 2017 01:09 PM My Price 7.00

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

Not Rated(0)