#include <bits/stdc++.h>
using namespace std;
struct sa {
  int v, u;
} wei[200005];
int cmp(sa a, sa b) {
  if (a.u == b.u) return a.v < b.v;
  return a.u < b.u;
}
long long dp[200005], ci[200005];
int main() {
  int n, m;
  long long ans;
  while (cin >> n >> m) {
    memset(dp, 0, sizeof(dp));
    memset(ci, 0, sizeof(ci));
    for (int i = 1; i <= m; i++) {
      cin >> wei[i].u >> wei[i].v;
      if (wei[i].u > wei[i].v) swap(wei[i].u, wei[i].v);
      ci[wei[i].u]++;
      ci[wei[i].v]++;
    }
    sort(wei + 1, wei + m + 1, cmp);
    for (int i = 1; i <= m; i++)
      dp[wei[i].v] = max(dp[wei[i].v], dp[wei[i].u] + 1);
    ans = 0;
    for (int i = 1; i <= n; i++)
      ans = max(ans, (long long)((dp[i] + 1) * ci[i]));
    cout << ans << endl;
  }
  return 0;
}
