#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
int n, m;
int num = 0;
const int maxn = 1e5 + 5;
vector<int> g[maxn];
int ru[maxn];
long long ans = 0;
int dp[maxn];
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    ru[v]++;
    ru[u]++;
    if (v > u) {
      g[u].push_back(v);
    } else {
      g[v].push_back(u);
    }
  }
  for (int i = 1; i <= n; i++) {
    dp[i] = 1;
  }
  for (int u = 1; u <= n; u++) {
    for (int i = 0; i < g[u].size(); i++) {
      int v = g[u][i];
      dp[v] = max(dp[v], dp[u] + 1);
    }
    ans = max(ans, (long long)dp[u] * (long long)ru[u]);
  }
  cout << ans << "\n";
  return 0;
}
