#include <bits/stdc++.h>
using namespace std;
int dep[100100];
vector<int> G[100100];
int main() {
  int n, m;
  cin >> n >> m;
  while (m--) {
    int u, v;
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    dep[i] = 1;
    for (int j = 0, sz = G[i].size(); j < sz; j++)
      if (G[i][j] < i) dep[i] = max(dep[i], dep[G[i][j]] + 1);
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++)
    ans = max(ans, (long long)dep[i] * (long long)G[i].size());
  cout << ans << endl;
  return 0;
}
