#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int i, j;
  int n;
  cin >> n;
  ;
  int m;
  cin >> m;
  ;
  vector<vector<int> > G(n);
  for (i = 0; i < m; i++) {
    int u;
    cin >> u;
    ;
    int v;
    cin >> v;
    ;
    u--;
    v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  vector<int> dp(n, 1);
  long long ans = 1;
  for (i = 0; i < n; i++) {
    int deg = int((G[i]).size());
    for (j = 0; j < deg; j++) {
      int v = G[i][j];
      if (v < i) dp[i] = max(dp[i], dp[v] + 1);
    }
    ans = max(ans, (long long)deg * (long long)dp[i]);
  }
  cout << ans << '\n';
}
