#include <bits/stdc++.h>
const int maxn = 1000000;
using namespace std;
long long ans;
vector<int> G[maxn];
int vis[maxn];
void dfs(int u, int len) {
  vis[u] = len;
  for (int i = 0; i < G[u].size(); i++) {
    int v = G[u][i];
    if (v > u && len + 1 > vis[v]) dfs(v, len + 1);
  }
}
int main() {
  int n, m;
  while (scanf("%d %d", &n, &m) != EOF) {
    memset(vis, 0, sizeof(vis));
    for (int i = 1; i <= n; i++) G[i].clear();
    int v, w;
    while (m--) {
      scanf("%d %d", &v, &w);
      G[v].push_back(w);
      G[w].push_back(v);
    }
    for (int i = 1; i <= n; i++) {
      sort(G[i].begin(), G[i].end());
      vis[i] = 1;
    }
    ans = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = 0; j < G[i].size(); j++) {
        if (G[i][j] < i) vis[i] = max(vis[i], vis[G[i][j]] + 1);
      }
      long long tmp = (long long)vis[i] * (long long)G[i].size();
      if (tmp > ans) ans = tmp;
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
