Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.
Problem hidden on 2015-11-23 11:21:35 by Min_25

BALSUBTR - Critical edge

You work in a telecommunication company, and now you are involved in a project responsible for making the system resilient to failures.

In a very simplified model, the network run by your company is a tree, and therefore for each pair of nodes there exists a unique path that connects these nodes. Conversely, for every edge we can calculate the number of pairs that use this edge.

Your task is to find an edge in the graph that maximizes the number of pairs that use this edge, as such an edge is the most critical part of the network --- its failure will disconnect the most nodes.

Input

First line of input consists of one number n, the number of nodes in the network.

In the next n-1 lines you will be given the description of edges of the tree. Every line consists of two number u and v, meaning that between nodes u and v there exists an edge.

Output

Your program should output a single edge which disconnects the most nodes. Vertices of the edge should be ordered (i.e., 2 4 instead of 4 2). If there exist many edges that disconnect the same number of nodes, then you should output the one which is first lexicographically (i.e., 2 5 instead of 3 4)

Example

Input:
4
1 2
2 3
3 4

Output:
2 3


Input:

4
1 2
2 3
2 4 Output: 1 2

Added by:Marek Adamczyk
Date:2015-11-09
Time limit:1s-5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU JS-MONKEY

hide comments
2015-11-17 04:32:34 Amara
Please activate the submission button
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.