TWOPATHS - Two Paths

题意翻译

求选出两条不相交树链的长度的最大乘积 数据范围1e5

题目描述

In Flatland there are _N_ cities, connected by _N-1_ two-way roads. The cities are numbered from 1 to _N_. You can get from one city to another moving along the roads. The "Two Paths" company, has won a tender to repair two paths in Flatland. A path is a sequence of different cities, connected sequentially by roads. The company is allowed to choose by itself the paths to repair. The only condition they have to meet is that the two paths shouldn't cross (i.e. shouldn't have common cities). It is known that the profit, the "Two Paths" company will get, equals the product of the lengths of the two paths. Let's consider the length of each road equals 1, and the length of a path equals the amount of roads in it. Find the maximum possible profit for the company.

输入输出格式

输入格式


The first line contains an integer _N_ (2 N N is the amount of cities in the country. The following _N-1_ lines contain the information about the roads. Each line contains a pair of numbers of the cities, connected by the road _a_ and _b (1_

输出格式


Output the maximum possible profit.

输入输出样例

输入样例 #1

4
1 2
2 3
3 4
\n

输出样例 #1