Recall that an unrooted tree of size $$$n$$$ is an undirected connected graph with $$$n - 1$$$ edges.
Given an unrooted tree of size $$$n$$$, find two nodes $$$u$$$ and $$$v$$$, such that when the undirected edge $$$(u, v)$$$ is added to the tree, a simple cycle that consists of at least $$$3$$$ nodes is created.
It can be shown that under the constraints of the problem, an answer always exists.
The first line of the input consists of a single integer $$$n$$$ $$$(3 \le n \le 100)$$$, the size of the tree.
On each of the next $$$n - 1$$$ lines, there are two integers $$$u$$$, $$$v$$$ $$$(1 \le u, v \le n)$$$, representing an edge in the tree between nodes $$$u$$$ and $$$v$$$.
It is guaranteed that the input provides a valid tree.
Output exactly two integers $$$u$$$ and $$$v$$$, such that when the edge $$$(u, v)$$$ is added to the tree, there is a cycle of size at least $$$3$$$.
31 22 3
1 3
41 21 33 4
1 4
See the second example after the edge $$$(1, 4)$$$ is added: