#include <bits/stdc++.h>
using namespace std;
long long m, n;
vector<vector<long long> > graph;
long long dist[100005];
long long get(long long i) {
  if (i == 1) {
    dist[i] = 1;
    return 1;
  }
  if (dist[i] != -1) return dist[i];
  long long sz = graph[i].size();
  long long ret = 1;
  for (long long j = 0; j < sz; j++) {
    if (graph[i][j] < i) {
      ret = max(get(graph[i][j]) + 1, ret);
    }
  }
  dist[i] = ret;
  return ret;
}
int main() {
  memset(dist, -1, sizeof(dist));
  cin >> n >> m;
  graph.resize(n + 1);
  for (long long i = 0; i < m; i++) {
    long long u, v;
    cin >> u >> v;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  for (long long i = 1; i <= n; i++) {
    if (dist[i] == -1) get(i);
  }
  long long ans = -1;
  for (long long i = 1; i <= n; i++) {
    long long sz = graph[i].size();
    ans = max(ans, sz * dist[i]);
  }
  cout << ans << endl;
  return 0;
}
