#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 1;
vector<int> g[MAXN];
int dp[MAXN];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    dp[i + 1] = 1;
    for (int j = 0; j < (int)(g[i + 1].size()); j++)
      dp[i + 1] = max(dp[i + 1], dp[g[i + 1][j]] + 1);
    ans = max(ans, 1ll * (int)(g[i + 1].size()) * dp[i + 1]);
  }
  printf("%I64d", ans);
  return 0;
}
