You are the proud owner of a newly built house in the Efficient Residences complex, so effectively built that there are no redundant streets in it, looking like a tree from higher up. Rumor has it that the constructor will start connecting houses to the sewage network. You know in which order will the constructor go through the houses. Since you want yours connected as soon as possible, you count up a bribe to change a small part of the ordering process in your favour.
You are given a tree with $$$N$$$ nodes that is rooted in the node with index $$$1$$$. You are also given the index of a node $$$K$$$, $$$1 \leq K \leq N$$$. We can do the following types of tree searches:
After we change the search type (e.g. in node $$$z$$$), we will only visit the nodes from $$$z$$$'s subtree further on. We suppose that $$$z$$$ was already visited in the first search.
You must compute for each of the two types of hybrid searches what is the smallest position in which the node with index $$$K$$$ can appear.
The tree neighbours are considered in the Breadth/Depth-First Searches in the order given in the input. You can consult below the exact implementations we use for DFS and BFS:
The first line contains two numbers, $$$N$$$ and $$$K$$$ ($$$1 \leq N \leq 10^5$$$).
The next $$$N - 1$$$ lines contain two numbers each, $$$A$$$ and $$$B$$$ ($$$1 \leq A, B \leq N$$$). There is an edge in the tree between the nodes indexed $$$A$$$ and $$$B$$$.
If $$$Y$$$ and $$$Z$$$ are children of $$$X$$$ and the edge $$$X$$$ $$$Y$$$ (or $$$Y$$$ $$$X$$$) appears before the edge $$$X$$$ $$$Z$$$ (or $$$Z$$$ $$$X$$$) in the input, then $$$Y$$$ will appear before $$$Z$$$ in any DFS or BFS from a node whose subtree contains $$$X$$$.
Write on the first line the smallest position in the hybrid search the node indexed $$$K$$$ may be found (counting from $$$1$$$), if we start with a BFS.
Write on the second line the analog if we start with a DFS.
16 131 21 31 41 52 62 73 114 154 167 87 911 1211 139 1012 14
7 11
15 101 21 32 42 53 63 74 84 95 105 116 126 137 147 15
6 7
11 101 21 33 44 54 65 77 86 96 101 11
9 9
For the first example, if we start with BFS, it is optimal to switch to DFS in node $$$3$$$, $$$K = 13$$$ being the seventh visited node. If we switched in node $$$11$$$ instead, we would have needed $$$11$$$ positions instead. If we start with DFS, we could optimally change in either node $$$3$$$ or node $$$11$$$.
For the second example, if we start with DFS, it is also possible to achieve $$$7$$$ if we never change to BFS.
For the third example, it doesn't matter with which search we begin, as both hybrid strategies have an optimal answer of $$$9$$$. Note that if we instead only used one of the two basic searches, we would have gotten both times an answer of $$$10$$$.
| Name |
|---|


