#include <bits/stdc++.h>
using namespace std;
vector<int> graph[200005];
int dist[200005];
int main() {
  int n, m, i, j;
  cin >> n >> m;
  for (i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  for (i = 1; i <= n; i++) {
    for (j = 0; j < graph[i].size(); j++) {
      int v = graph[i][j];
      if (v > i) {
        if (dist[i] + 1 > dist[v]) {
          dist[v] = dist[i] + 1;
        }
      }
    }
  }
  long long maxm = 0;
  for (i = 1; i <= n; i++) {
    long long sz = graph[i].size();
    long long d = dist[i] + 1;
    if ((sz * d) > maxm) maxm = sz * d;
  }
  cout << maxm;
  return 0;
}
