#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
vector<int> g[maxn];
int dp[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n, m, a, b;
  cin >> n >> m;
  for (int(i) = (0); (i) < (m); (i)++) {
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  long long int ans = 0;
  for (int(i) = (1); (i) < (n + 1); (i)++) {
    dp[i] = 1;
    for (int u : g[i]) {
      if (u < i) dp[i] = max(dp[i], dp[u] + 1);
    }
    ans = max(ans, dp[i] * (long long int)g[i].size());
  }
  cout << ans << '\n';
}
