Polarization

No attempts yetTime limit3sMemory limit512 MB

Problem

Everyone knew this day would come. A danger you live beside for years turns into ordinary life and stops carrying any weight.

Today the letter that Bittard, ruler of Bitotia, sent to Byteasar, king of Byteotia, was made public. Bitotia demands the annexation of all of Byteotia and threatens to use the Bit Polarizing Magnet (BPM) if the demand is refused.

Once the BPM fires, every road in Byteotia becomes one way. Byteotia built its road network as sparsely as it could, so exactly one route runs between any two towns. That is why the blow could be fatal.

Work out how much damage the BPM can do. After every road has been given a direction, count the pairs of towns for which it is still possible to travel from one town of the pair to the other while respecting the new directions. Over all the ways of directing the roads, find the minimum and the maximum of that count.

Input

The first line of input holds one integer nn (1n2500001 \le n \le 250\,000), the number of towns in Byteotia. The towns are numbered from 11 to nn.

Each of the next n1n-1 lines holds two integers uu and vv (1uvn1 \le u \le v \le n), meaning that a road directly joins town uu and town vv. That road is still two way for now. The roads connect the towns so that exactly one route runs between any two of them.

Output

Print two integers on one line, separated by a space: first the minimum, then the maximum number of pairs of towns that stay reachable in one direction after the roads are polarized.