#include <bits/stdc++.h>
using namespace std;
long long deg[100004];
vector<int> g[100004];
long long d[100004];
int dfs(int s) {
  if (d[s] != -1) return d[s];
  long long ans = 1;
  for (int i = 0; i < g[s].size(); i++) {
    int v = g[s][i];
    ans = (ans > dfs(v) + 1 ? ans : dfs(v) + 1);
  }
  return d[s] = ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
  int n, m, i, u, v;
  cin >> n >> m;
  for (i = 1; i <= m; i++) {
    cin >> u >> v;
    if (u < v) swap(u, v);
    g[u].push_back(v);
    deg[u]++;
    deg[v]++;
  }
  for (i = 1; i <= n; i++) {
    d[i] = -1;
  }
  for (i = n; i >= 1; i--) {
    d[i] = dfs(i);
  }
  long long ans = 0;
  for (i = 1; i <= n; i++) {
    ans = (ans > (1LL * deg[i]) * (1LL * d[i]) ? ans
                                               : (1LL * deg[i]) * (1LL * d[i]));
  }
  cout << ans << endl;
  return 0;
}
