#include <bits/stdc++.h>
using namespace std;
const int maxN = 1 << 17;
int dp[maxN];
vector<int> g[maxN];
int main() {
  ios_base::sync_with_stdio(0);
  int n, m, i, x, y;
  cin.tie(0);
  cin >> n >> m;
  while (m--) {
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  long long int ans = -1;
  for (i = 1; i <= n; ++i) {
    dp[i] = 1;
    for (int j = 0; j < g[i].size(); ++j)
      if (g[i][j] < i) dp[i] = max(dp[i], dp[g[i][j]] + 1);
    ans = max(ans, dp[i] * (long long int)g[i].size());
  }
  cout << ans;
  return 0;
}
