#include <bits/stdc++.h>
using namespace std;
int dp[100005];
vector<int> E[100005];
int cnt[100005];
long long IN() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int main() {
  int n, m;
  while (cin >> n >> m) {
    for (int i = 0; i < m; i++) {
      int x, y;
      x = IN();
      y = IN();
      if (x < y) swap(x, y);
      E[x].push_back(y);
      cnt[x]++;
      cnt[y]++;
    }
    long long ans = 0;
    for (int i = 0; i <= n; i++) {
      for (int j = 0; j < E[i].size(); j++) dp[i] = max(dp[i], dp[E[i][j]]);
      dp[i]++;
      ans = max(ans, (long long)dp[i] * cnt[i]);
    }
    cout << ans << endl;
  }
}
