#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 20, MOD = 1e9 + 7;
long long d[N], dp[N];
vector<long long> e[2 * N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i < 1LL * m + 1; i++) {
    int u, v;
    cin >> u >> v;
    d[u]++;
    d[v]++;
    e[max(u, v)].push_back(min(u, v));
  }
  for (long long i = 1; i < 1LL * n + 1; i++) {
    for (long long j = 0; j < 1LL * e[i].size(); j++)
      dp[i] = max(dp[e[i][j]] + 1, dp[i]);
  }
  cerr << "dp"
       << ": { ";
  for (long long i = 0; i < 1LL * n; i++)
    cerr << dp[i] << ((i != n - 1) ? ", " : " ");
  cerr << '}' << '\n';
  ;
  long long mx = 0;
  for (long long i = 1; i < 1LL * n + 1; i++) mx = max(mx, (dp[i] + 1) * d[i]);
  cout << mx << '\n';
  return 0;
}
