#include <bits/stdc++.h>
using namespace std;
vector<vector<long long>> adj(100005);
vector<long long> vis(100005, 0), length(100005, 1), deg(100005, 0);
long long n, m;
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  long long u, v;
  for (long long i = 1; i <= m; i++) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
    deg[v]++;
    deg[u]++;
  }
  for (long long i = 1; i <= n; i++) {
    for (auto j : adj[i])
      if (j > i) length[j] = max(length[j], length[i] + 1);
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) ans = max(ans, deg[i] * length[i]);
  cout << ans;
  return 0;
}
