TWOPATHS  Two Paths
In Flatland there are N cities, connected by N1 twoway 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.
Input
The first line contains an integer N (2 ≤ N ≤ 100000), where N is the amount of cities in the country. The following N1 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 ≤ a, b ≤ N)
Output
Output the maximum possible profit.
Example
Input:
4
1 2
2 3
3 4
Output:
1
hide comments
kamisama2002:
20181019 06:16:25
why time limit is so strict :((((( 

hatuank97lhp:
20181008 03:07:00
Last edit: 20181008 03:07:32 

ANSH KHANNA:
20160628 21:06:23
strict time limit :/


AchMav:
20120501 05:16:02
Last edit: 20120501 05:29:39 

Almaz:
20110310 11:21:05
9


ajeet kumar:
20110129 06:23:58
do anyone can give another test case 

[Rampage] Blue.Mary:
20100609 14:14:15
If another sample is provided I won't have the 1st WA... 
Added by:  Oleg 
Date:  20100531 
Time limit:  0.100s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: NODEJS OBJC PERL6 SQLITE VB.NET 
Resource:  Codeforces round 14 with larger limits 