#include <bits/stdc++.h>
using namespace std;
vector<long long int> adj[1000001], vis(1000001), degree(1000001);
long long int ans = -1;
long long int dp[1000001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  for (long long int i = 1; i <= m; i++) {
    long long int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
    degree[u]++;
    degree[v]++;
  }
  for (long long int i = 1; i <= n; i++) {
    dp[i] = 1;
  }
  for (long long int i = 1; i <= n; i++) {
    for (auto j : adj[i]) {
      if (j > i) {
        dp[j] = max(dp[j], dp[i] + 1);
      }
    }
  }
  for (long long int i = 1; i <= n; i++) {
    ans = max(ans, dp[i] * degree[i]);
  }
  cout << ans;
}
