#include <bits/stdc++.h>
using namespace std;
template <class T>
T mod_f(T num) {
  if (num >= 0)
    return num % 1000000007;
  else
    return ((num % 1000000007) + 1000000007) % 1000000007;
}
template <class T>
T fast_pow(T b, T p) {
  if (p == 0) return 1;
  if (p % 2) {
    T x = mod_f(mod_f(b) * mod_f(fast_pow(b, p - 1)));
    return x;
  } else {
    T x = mod_f(fast_pow(b, p / 2));
    x = mod_f(mod_f(x) * mod_f(x));
    return x;
  }
}
template <class T>
T gcd(T a, T b) {
  a = abs(a);
  b = abs(b);
  while (b) {
    T r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
ostream& operator<<(ostream& out, vector<T> v) {
  int sz = v.size() - 1;
  for (int i = 0; i <= sz; i++) out << v[i] << " ";
  return out;
}
template <class T>
ostream& operator,(ostream& out, T a) {
  out << a << " ";
  return out;
}
int cnt[100001], dp[100001];
vector<int> adj[100001];
int main() {
  int n, m, u, v, i;
  long long int ans;
  cin >> n >> m;
  for (i = 1; i <= m; i++) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
    ++cnt[u];
    ++cnt[v];
  }
  ans = 0;
  for (i = 1; i <= n; i++) {
    dp[i] = 1;
    for (int x = 0; x < adj[i].size(); x++) {
      u = adj[i][x];
      if (u < i) dp[i] = max(dp[i], dp[u] + 1);
    }
    ans = max(ans, dp[i] * 1LL * cnt[i]);
  }
  cout << ans;
  return 0;
}
