#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, m, x, y, con[N], tot[N];
int head[N], nxt[N * 4], to[N * 4], cnt;
void addedge(int u, int v) {
  to[cnt] = v;
  nxt[cnt] = head[u];
  con[u]++;
  head[u] = cnt++;
}
int dfs(int u) {
  if (tot[u]) return tot[u];
  for (int i = head[u]; ~i; i = nxt[i])
    if (to[i] < u) {
      tot[u] = max(tot[u], 1 + dfs(to[i]));
    }
  return tot[u] ? tot[u] : tot[u] = 1;
}
int main() {
  while (~scanf("%d%d", &n, &m)) {
    memset(head, -1, sizeof(head));
    memset(con, 0, sizeof(con));
    memset(tot, 0, sizeof(tot));
    cnt = 0;
    for (int i = 0; i < m; i++) {
      scanf("%d%d", &x, &y);
      addedge(x, y), addedge(y, x);
    }
    for (int i = 1; i <= n; i++) dfs(i);
    long long res = 0;
    for (int i = 1; i <= n; i++) res = max(res, (long long)con[i] * tot[i]);
    printf("%I64d\n", res);
  }
  return 0;
}
