#include <bits/stdc++.h>
using namespace std;
vector<long long> v[100005];
long long n, m, i, a, b, h[100005] = {0}, dp[100005] = {0}, ans;
long long dfs(long long n) {
  long long len = 1;
  for (long long j = 0; j < v[n].size(); j++) {
    if (dp[v[n][j]] == 0)
      len = max(len, dfs(v[n][j]) + 1);
    else
      len = max(len, dp[v[n][j]] + 1);
  }
  dp[n] = len;
  return len;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  while (m--) {
    cin >> a >> b;
    h[a]++;
    h[b]++;
    if (a > b) {
      v[a].push_back(b);
    } else {
      v[b].push_back(a);
    }
  }
  for (i = 1; i <= n; i++) {
    if (!dp[i]) dfs(i);
  }
  ans = 0;
  for (i = 1; i <= n; i++) {
    ans = max(ans, dp[i] * h[i]);
  }
  cout << ans << endl;
  return 0;
}
