The input consists of a number of cases. The first line on each case contains a positive number n (1 < n ≤ 100) that specifies the number of points that César might visit (i.e., the number of nodes in the graph).
A value of n = 0 indicates the end of the input.
After this, a second number s is provided, indicating the starting point in César's journey (1 ≤ s ≤ n). Then, you are given a list of pairs of places p and q, one pair per line, with the places on each line separated by white-space. The pair "p q" indicates that César can visit q after p.
A pair of zeros ('0 0') indicates the end of the case.
As mentioned before, you can assume that the graphs provided will not be cyclic and that every place will be reachable from the starting place.
For each test case you have to find the length of the longest path that begins at the starting place. You also have to print the number of the final place of such longest path. If there are several paths of maximum length, print the final place with smallest number.
Print a new line after each test case.