#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> edge[n];
  vector<int> cnt(n, 0);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    if (a > b) swap(a, b);
    edge[a].push_back(b);
    cnt[b]++;
    cnt[a]++;
  }
  vector<int> level(n, 1);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < (int)edge[i].size(); j++) {
      level[edge[i][j]] = max(level[edge[i][j]], level[i] + 1);
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans = max(ans, (long long)level[i] * cnt[i]);
  }
  cout << ans << endl;
  return 0;
}
