#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> adj[111111];
long long h[111111];
int u, v;
long long best = -1;
int main() {
  scanf("%d %d", &n, &m);
  while (m--) {
    scanf("%d %d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    h[i] = 1;
    for (unsigned int j = 0; j < adj[i].size(); j++)
      h[i] = max(h[i], h[adj[i][j]] + 1LL);
    best = max(best, (long long)adj[i].size() * h[i]);
  }
  cout << best << endl;
  return 0;
}
