#include <bits/stdc++.h>
using namespace std;
const signed int MAX = 1e5 + 5;
signed int N;
signed int M;
vector<signed int> g[MAX];
signed int deg[MAX];
bool vis[MAX];
signed int dp[MAX];
void dfs(signed int u) {
  vis[u] = 1;
  for (typeof((g[u]).begin()) itr = (g[u]).begin(); itr != (g[u]).end(); itr++)
    if (!vis[*itr]) dfs(*itr);
  dp[u] = 1;
  for (typeof((g[u]).begin()) itr = (g[u]).begin(); itr != (g[u]).end(); itr++)
    dp[u] = max(dp[u], 1 + dp[*itr]);
}
signed int main() {
  scanf("%d %d", &N, &M);
  signed int u, v;
  for (signed int i = 0; i < (M); ++i) {
    scanf("%d %d", &u, &v);
    deg[u]++;
    deg[v]++;
    if (u > v) swap(u, v);
    g[v].push_back(u);
  }
  for (signed int i = (1); i <= (N); ++i)
    if (!vis[i]) dfs(i);
  signed long long ans = 0;
  for (signed int i = (1); i <= (N); ++i) ans = max(ans, 1LL * deg[i] * dp[i]);
  printf("%I64d\n", ans);
  return 0;
}
