This Christmas Santa gave Masha a magic picture and a pencil. The picture consists of n points connected by m segments (they might cross in any way, that doesn't matter). No two segments connect the same pair of points, and no segment connects the point to itself. Masha wants to color some segments in order paint a hedgehog. In Mashas mind every hedgehog consists of a tail and some spines. She wants to paint the tail that satisfies the following conditions:   Only segments already presented on the picture can be painted;  The tail should be continuous, i.e. consists of some sequence of points, such that every two neighbouring points are connected by a colored segment;  The numbers of points from the beginning of the tail to the end should strictly increase. 

Masha defines the length of the tail as the number of points in it. Also, she wants to paint some spines. To do so, Masha will paint all the segments, such that one of their ends is the endpoint of the tail. Masha defines the beauty of a hedgehog as the length of the tail multiplied by the number of spines. Masha wants to color the most beautiful hedgehog. Help her calculate what result she may hope to get.

Note that according to Masha's definition of a hedgehog, one segment may simultaneously serve as a spine and a part of the tail (she is a little girl after all). Take a look at the picture for further clarifications.


-----Input-----

First line of the input contains two integers n and m(2 ≤ n ≤ 100 000, 1 ≤ m ≤ 200 000) — the number of points and the number segments on the picture respectively. 

Then follow m lines, each containing two integers u_{i} and v_{i} (1 ≤ u_{i}, v_{i} ≤ n, u_{i} ≠ v_{i}) — the numbers of points connected by corresponding segment. It's guaranteed that no two segments connect the same pair of points.


-----Output-----

Print the maximum possible value of the hedgehog's beauty.


-----Examples-----
Input
8 6
4 5
3 5
2 5
1 2
2 8
6 7

Output
9

Input
4 6
1 2
1 3
1 4
2 3
2 4
3 4

Output
12



-----Note-----

The picture below corresponds to the first sample. Segments that form the hedgehog are painted red. The tail consists of a sequence of points with numbers 1, 2 and 5. The following segments are spines: (2, 5), (3, 5) and (4, 5). Therefore, the beauty of the hedgehog is equal to 3·3 = 9.

[Image]

Difficulty: MEDIUM_HARD

Solutions:
(n, m) = [int(x) for x in input().split()]
values = [1] * n
nodes = [list() for _ in range(n)]
spikes = [0] * n
for _ in range(m):
	(n1, n2) = [int(x) for x in input().split()]
	if n1 > n2:
		(n1, n2) = (n2, n1)
	nodes[n1 - 1].append(n2 - 1)
	spikes[n1 - 1] += 1
	spikes[n2 - 1] += 1
for i in range(0, n):
	for node in nodes[i]:
		values[node] = max(values[node], values[i] + 1)
m = max(list(range(n)), key=lambda i: spikes[i] * values[i])
print(spikes[m] * values[m])


(n, m) = list(map(int, input().split()))
p = [0] * n
e = []
for i in range(m):
	(q, w) = list(map(int, input().split()))
	p[w - 1] += 1
	p[q - 1] += 1
	e.append([min(q, w), max(q, w)])
dp = [1] * n
e.sort()
for i in range(m):
	dp[e[i][1] - 1] = max(dp[e[i][1] - 1], dp[e[i][0] - 1] + 1)
ans = 0
for i in range(n):
	ans = max(ans, dp[i] * p[i])
print(ans)


def main():
	(n, m) = list(map(int, input().split()))
	n += 1
	children = [[] for _ in range(n)]
	(degree, depth) = ([0] * n, [1] * n)
	for _ in range(m):
		(u, v) = list(map(int, input().split()))
		if u < v:
			children[u].append(v)
		else:
			children[v].append(u)
		degree[u] += 1
		degree[v] += 1
	for (a, c) in zip(depth, children):
		for v in c:
			if depth[v] <= a:
				depth[v] = a + 1
	print(max((a * b for (a, b) in zip(depth, degree))))

def __starting_point():
	main()
__starting_point()


(n, m) = map(int, input().split())
edges = []
max_lens = []
for i in range(n + 1):
	edges.append(set())
	max_lens.append(1)
for i in range(m):
	(u, v) = map(int, input().split())
	edges[u].add(v)
	edges[v].add(u)
maximum = 0
for i in range(1, n + 1):
	for j in edges[i]:
		if j < i:
			max_lens[i] = max(max_lens[i], max_lens[j] + 1)
	maximum = max(len(edges[i]) * max_lens[i], maximum)
print(maximum)


from collections import defaultdict
(n, m) = map(int, input().split())
G = defaultdict(list)
for _ in range(m):
	(u, v) = map(int, input().split())
	G[u].append(v)
	G[v].append(u)
rs = [1] * n
for u in range(1, n + 1):
	for v in G[u]:
		if v < u:
			rs[u - 1] = max(rs[u - 1], rs[v - 1] + 1)
print(max((rs[i] * len(G[i + 1]) for i in range(len(rs)))))


import sys
l = 0
ady = [[]]
ady2 = [[]]
for line in sys.stdin:
	if l == 0:
		(n, m) = line.split()
		n = int(n)
		m = int(m)
		ady = [[] for i in range(n)]
		ady2 = [[] for i in range(n)]
	else:
		(a, b) = map(int, line.split())
		a = int(a) - 1
		b = int(b) - 1
		ady2[a].append(b)
		ady2[b].append(a)
		if a > b:
			ady[a].append(b)
		else:
			ady[b].append(a)
	l += 1
c = [0] * n

def colamaslarga(a):
	if len(ady[a]) == 0:
		c[a] = 1
		return 1
	elif c[a] != 0:
		return c[a]
	else:
		res = max([colamaslarga(ad) for ad in ady[a]]) + 1
		c[a] = res
		return res
mx = 0
for i in range(n):
	cl = colamaslarga(i)
	res = cl * len(ady2[i])
	if res > mx:
		mx = res
print(mx)


read = lambda : map(int, input().split())
(n, m) = read()
g = [list() for i in range(n + 1)]
cnt = [0] * (n + 1)
dist = [0] * (n + 1)
for i in range(m):
	(u, v) = read()
	cnt[u] += 1
	cnt[v] += 1
	if u < v:
		(u, v) = (v, u)
	g[u].append(v)
for v in range(1, n + 1):
	res = 1
	for u in g[v]:
		res = max(res, dist[u] + 1)
	dist[v] = res
ans = max((dist[i] * cnt[i] for i in range(1, n + 1)))
print(ans)


(n, m) = map(int, input().split())
A = [[] for _ in range(n + 1)]
B = [0 for _ in range(n + 1)]
for i in range(m):
	(u, v) = map(int, input().split())
	if u > v:
		(u, v) = (v, u)
	A[u].append(v)
	B[u] += 1
	B[v] += 1
C = [0 for _ in range(n + 1)]
X = B[1]
for u in range(1, n + 1):
	for v in A[u]:
		C[v] = max(C[v], C[u] + 1)
		X = max(X, (C[v] + 1) * B[v])
print(X)


(n, m) = [int(x) for x in input().split()]
E = {i: [] for i in range(1, n + 1)}
for i in range(m):
	(u, v) = [int(x) for x in input().split()]
	E[v].append(u)
	E[u].append(v)
tail = {i: 0 for i in range(1, n + 1)}
tail[1] = 1
for u in range(2, n + 1):
	tail[u] = max((tail[v] for v in E[u]), default=0) + 1
print(max((tail[u] * len(E[u]) for u in range(1, n + 1))))


(n, m) = map(int, input().split())
graph = [list() for _ in range(n + 1)]
count = [0 for _ in range(n + 1)]
dp = [0 for _ in range(n + 1)]
for _ in range(m):
	(u, v) = map(int, input().split())
	if v < u:
		(u, v) = (v, u)
	graph[v].append(u)
	count[v] += 1
	count[u] += 1
for i in range(1, n + 1):
	best = 1
	for j in graph[i]:
		best = max(best, dp[j] + 1)
	dp[i] = best
result = 1
for i in range(1, n + 1):
	if dp[i] * count[i] > result:
		result = dp[i] * count[i]
print(result)


R = lambda : map(int, input().split())
(n, m) = R()
adj = [[] for _ in range(n)]
from collections import defaultdict
d = defaultdict(int)
for i in range(m):
	(u, v) = R()
	if u > v:
		(u, v) = (v, u)
	adj[u - 1].append(v - 1)
	d[u - 1] += 1
	d[v - 1] += 1
h = defaultdict(int)
for i in range(n):
	h[i] = max(h[i], 1)
	for v in adj[i]:
		h[v] = max(h[v], h[i] + 1)
mx = 0
for i in range(n):
	mx = max(mx, h[i] * d[i])
print(mx)


(n, m) = map(int, input().split())
G = [[] for i in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	G[a - 1].append(b - 1)
	G[b - 1].append(a - 1)
max_dist = 0
dist = [0] * n
for v in range(n):
	dist[v] = 1
	for u in G[v]:
		if u < v:
			dist[v] = max(dist[v], dist[u] + 1)
		max_dist = max(max_dist, dist[v] * len(G[v]))
print(max_dist)


(n, m) = map(int, input().split())
children = [[] for u in range(n + 1)]
degree = [0 for u in range(n + 1)]
for i in range(m):
	(u, v) = map(int, input().split())
	if u > v:
		(u, v) = (v, u)
	children[u].append(v)
	degree[u] += 1
	degree[v] += 1
depth = [0 for u in range(n + 1)]
best = degree[1]
for u in range(1, n + 1):
	for v in children[u]:
		depth[v] = max(depth[v], depth[u] + 1)
		best = max(best, (depth[v] + 1) * degree[v])
print(best)


(n, m) = map(int, input().split())
g = [[] for i in range(n)]
for _ in range(m):
	(u, v) = map(int, input().split())
	u -= 1
	v -= 1
	g[u].append(v)
	g[v].append(u)
dp = [1] * n
for i in range(n):
	for j in g[i]:
		if i < j:
			dp[j] = max(dp[j], dp[i] + 1)
ans = 0
for i in range(n):
	ans = max(ans, len(g[i]) * dp[i])
print(ans)


from sys import stdin, setrecursionlimit
setrecursionlimit(100000)

class Graph:

	def __init__(self, No_of_nodes):
		self.n = No_of_nodes
		self.adj = [[] for i in range(self.n)]

	def addEdge(self, a, b):
		self.adj[a].append(b)
		self.adj[b].append(a)
		count[a][0] += 1
		count[b][0] += 1

def solve(start):
	for i in g.adj[start]:
		if i < start:
			dp[start] = max(dp[start], dp[i] + 1)
	return dp[start]
(n, m) = map(int, stdin.readline().split())
g = Graph(n)
count = [[0, i] for i in range(n)]
dp = [1] * n
for i in range(m):
	(a, b) = map(int, stdin.readline().split())
	a -= 1
	b -= 1
	g.addEdge(a, b)
for i in range(n):
	solve(i)
ans = -1000
for i in range(n):
	if dp[i] != -1:
		ans = max(ans, dp[i] * len(g.adj[i]))
print(ans)


inp = input().split()
(n, m) = (int(inp[0]), int(inp[1]))
a = [[] for _ in range(n + 1)]
for i in range(m):
	inp = input().split()
	(x, y) = (int(inp[0]), int(inp[1]))
	a[x - 1].append(y - 1)
	a[y - 1].append(x - 1)
dp = [1 for _ in range(n)]
for i in range(n):
	for j in range(len(a[i])):
		if i < a[i][j]:
			dp[a[i][j]] = max(dp[a[i][j]], dp[i] + 1)
ans = 0
for i in range(n):
	ans = max(ans, dp[i] * len(a[i]))
print(ans)


class graph:

	def __init__(self, n):
		self.n = n
		self.adj = [[] for _ in range(n)]

	def adde(self, n, m):
		self.adj[n].append(m)
		self.adj[m].append(n)

	def findmax(self):
		mscore = 0
		for node in range(self.n):
			tail = self.DFS(node)
			spines = len(self.adj[node])
			mscore = max(tail * spines, mscore)
			print(tail, spines, mscore)
		return mscore

	def DFS(self, s):
		ml = 0
		for edge in self.adj[s]:
			if edge > s:
				continue
			ml = max(self.DFS(edge), ml)
		return ml + 1

	def dp(self):
		pathlengths = [1 for _ in self.adj]
		maxscore = 0
		for i in range(self.n):
			local_max = 1
			for node in self.adj[i]:
				if node < i:
					local_max = max(local_max, pathlengths[node] + 1)
			pathlengths[i] = local_max
			maxscore = max(maxscore, local_max * len(self.adj[i]))
		return maxscore
(n, m) = [int(x) for x in input().split()]
g = graph(n)
for _ in range(m):
	(u, v) = [int(x) for x in input().split()]
	g.adde(u - 1, v - 1)
print(g.dp())


class Node:

	def __init__(self, i):
		self.i = i
		self.adj = []

def draw_hedgehog(n, nodes):
	tail_length = [1] * n
	best_beauty = len(nodes[0].adj)
	for i in range(1, n):
		max_so_far = tail_length[i]
		best_length = tail_length[i]
		spines = len(nodes[i].adj)
		for j in nodes[i].adj:
			if j < i:
				beauty = (tail_length[j] + 1) * spines
				if beauty > max_so_far:
					max_so_far = beauty
					best_length = tail_length[j] + 1
		tail_length[i] = best_length
		if max_so_far > best_beauty:
			best_beauty = max_so_far
	return best_beauty
(n, m) = input().split()
(n, m) = (int(n), int(m))
nodes = [Node(i) for i in range(n)]
for k in range(m):
	(u, v) = input().split()
	(u, v) = (int(u) - 1, int(v) - 1)
	nodes[u].adj.append(v)
	nodes[v].adj.append(u)
result = draw_hedgehog(n, nodes)
print(result)


from collections import defaultdict
graph = defaultdict(list)
(n, m) = list(map(int, input().split()))
for i in range(m):
	(v, u) = list(map(int, input().split()))
	graph[v].append(u)
	graph[u].append(v)
dp = [1] * (n + 1)
ans = len(graph[1])
for i in range(2, n + 1):
	for v in graph[i]:
		if v < i:
			dp[i] = max(dp[i], dp[v] + 1)
	ans = max(ans, dp[i] * len(graph[i]))
print(ans)


(n, m) = map(int, input().split())
graph = [[i] for i in range(n + 2)]
dn = [0 for _ in range(n + 2)]
res = 0
for _ in range(m):
	(a, b) = map(int, input().split())
	graph[a].append(b)
	graph[b].append(a)
for node in range(1, n + 1):
	dn[node] = dn[max(graph[node] if graph[node] else [n + 1], key=lambda adj: dn[adj] + 1 if adj < node else 0)] + 1
	res = max(res, dn[node] * (len(graph[node]) - 1))
print(res)


(n, m) = map(int, input().split())
ans = 0
dp = [1] * n
deg = [0] * n
G = [[] for i in range(n)]
for i in range(m):
	(x, y) = map(int, input().split())
	if x > y:
		(x, y) = (y, x)
	x -= 1
	y -= 1
	deg[x] += 1
	deg[y] += 1
	G[x].append(y)
for i in range(n):
	ans = max(ans, dp[i] * deg[i])
	for j in G[i]:
		dp[j] = max(dp[j], dp[i] + 1)
print(ans)


import sys
(n, m) = sys.stdin.readline().split()
n = int(n)
m = int(m)
neighbours = []
ne = []
smaller = []
for i in range(n):
	neighbours.append(0)
	smaller.append(1)
	ne.append([])
for i in range(m):
	(f, t) = sys.stdin.readline().split()
	f = int(f) - 1
	t = int(t) - 1
	neighbours[f] += 1
	neighbours[t] += 1
	if f < t:
		ne[f].append(t)
	else:
		ne[t].append(f)
for i in range(n):
	for sysed in ne[i]:
		smaller[sysed] = max([smaller[sysed], smaller[i] + 1])
ans = 0
for i in range(n):
	ans = max([ans, smaller[i] * neighbours[i]])
print(ans)