#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 200010;
vector<int> G[maxn];
int cnt[maxn], dp[maxn];
int getll(long long &x) { return scanf("%I64d", &x); }
int n, m, u, v;
int main() {
  scanf("%d%d ", &n, &m);
  for (int i = 1; i <= n; i++) {
    dp[i] = 1;
    cnt[i] = 0;
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &u, &v);
    if (u < v) swap(u, v);
    G[u].push_back(v);
    cnt[u]++;
    cnt[v]++;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < G[i].size(); j++) {
      int cur = G[i][j];
      dp[i] = max(dp[i], dp[cur] + 1);
    }
  }
  long long ans = -0x3fffffff;
  for (int i = 1; i <= n; i++) {
    ans = max(ans, (long long)dp[i] * cnt[i]);
  }
  printf("%I64d\n", ans);
  return 0;
}
