#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  return (!b) ? a : gcd(b, a % b);
}
int m, n;
list<int> adj[100005];
long long int maxb = 1;
long long int dp[100005];
void solve() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  dp[1] = 1;
  for (int i = 1; i <= n; i++) {
    dp[i] = 1;
    for (auto x : adj[i]) {
      if (x < i) {
        dp[i] = max(dp[i], 1 + dp[x]);
      }
    }
    maxb = max(maxb, 1ll * dp[i] * (int)adj[i].size());
  }
  cout << maxb;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  if (fopen("input.txt", "r")) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  }
  int t = 1;
  while (t--) {
    solve();
  }
}
