#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> edges[n + 1];
  for (long long i = 1; i <= m; i++) {
    long long s, f;
    cin >> s >> f;
    edges[s].push_back(f);
    edges[f].push_back(s);
  }
  long long dp[n + 1];
  long long ans = INT_MIN;
  for (long long i = 1; i <= n; i++) {
    dp[i] = 1;
    for (long long j = 0; j < edges[i].size(); j++) {
      if (edges[i][j] < i) {
        dp[i] = max(dp[i], dp[edges[i][j]] + 1);
      }
    }
    ans = max(ans, (long long)edges[i].size() * dp[i]);
  }
  cout << ans << endl;
  return 0;
}
