#include <bits/stdc++.h>
using namespace std;
long long calcula(long long i, vector<long long>& llargaria,
                  const vector<vector<long long>>& graf) {
  if (llargaria[i] > -1) return llargaria[i];
  long long llarg = 1;
  for (long long j = 0; j < graf[i].size(); j++) {
    if (graf[i][j] < i)
      llarg = max(llarg, calcula(graf[i][j], llargaria, graf) + 1);
  }
  llargaria[i] = llarg;
  return llarg;
}
int main() {
  long long m, n;
  cin >> n >> m;
  vector<vector<long long>> graf(n);
  vector<long long> llargaria(n, -1);
  for (long long i = 0; i < m; i++) {
    long long v1, v2;
    cin >> v1 >> v2;
    v1--;
    v2--;
    graf[v1].push_back(v2);
    graf[v2].push_back(v1);
  }
  for (long long i = 0; i < n; i++) {
    calcula(i, llargaria, graf);
  }
  long long beauty = 0;
  for (long long i = 0; i < n; i++)
    beauty = max(beauty, llargaria[i] * ((long long)graf[i].size()));
  cout << beauty;
  return 0;
}
