#include <bits/stdc++.h>
using namespace std;
vector<int> g[500010];
int dp[500010] = {0};
int vis[500010] = {0};
long long dfs(int i) {
  if (vis[i]) return dp[i];
  long long ans = 0;
  vis[i] = 1;
  for (int j = 0; j < g[i].size(); j++) {
    if (g[i][j] < i) ans = max(ans, dfs(g[i][j]));
  }
  return dp[i] = ans + 1;
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d", &u);
    scanf("%d", &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  long long ans = -1;
  for (int i = n; i >= 0; i--) {
    int hh = g[i].size();
    ans = max(ans, hh * dfs(i));
  }
  printf("%lld\n", ans);
  return 0;
}
