#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
int n, m;
ll du[maxn], dp[maxn];
vector<int> g[maxn];

void dfs(int u) {
if (dp[u]) return;
ll temp = 0;
for (unsigned int i = 0; i < g[u].size(); i++) {
int v = g[u][i];
dfs(v);
temp = max(temp, dp[v]);
}
dp[u] = temp + 1;
}

int main() {
scanf("%d %d", &n, &m);
int u, v;
memset(du, 0, sizeof(du));
for (int i = 1; i <= m; i++) {
scanf("%d %d", &u, &v);
if (u < v) swap(u, v);
du[u]++; du[v]++;
g[u].push_back(v);
}
memset(dp, 0, sizeof(dp));
for (int i = 1; i <= n; i++) dfs(i);
ll ans = 0;
for (int i = 1; i <= n; i++) {
ans = max(ans, dp[i] * du[i]);
}
printf("%lld\n", ans);
return 0;
}