#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9 + 7;
const int MAXN = (int)3e5 + 7;
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
int n, m;
int deg[MAXN];
vector<int> g[MAXN];
int dp[MAXN];
int calc(int v) {
  if (dp[v] != -1) return dp[v];
  int res = 0;
  for (auto to : g[v]) res = max(res, calc(to));
  return dp[v] = res + 1;
}
int main() {
  memset(dp, -1, sizeof dp);
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    deg[u]++;
    deg[v]++;
    g[max(u, v)].push_back(min(u, v));
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = max(ans, 1ll * deg[i] * calc(i));
  }
  cout << ans;
  return 0;
}
