#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int u, v;
};
Edge edge[(200000 + 10)];
bool cmp(Edge a, Edge b) {
  if (a.u != b.u)
    return a.u < b.u;
  else
    return a.v < b.v;
}
int degree[(100000 + 10)], dp[(100000 + 10)];
int main() {
  int n, m;
  scanf("%d", &n);
  scanf("%d", &m);
  memset(degree, (0), sizeof(degree));
  memset(dp, (0), sizeof(dp));
  for (int i = 0; i < m; i++) {
    scanf("%d", &edge[i].u);
    scanf("%d", &edge[i].v);
    if (edge[i].u > edge[i].v) swap(edge[i].u, edge[i].v);
    degree[edge[i].u]++;
    degree[edge[i].v]++;
  }
  sort(edge, edge + m, cmp);
  for (int i = 0; i < m; i++)
    dp[edge[i].v] = max(dp[edge[i].v], dp[edge[i].u] + 1);
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans = max(ans, 1LL * degree[i] * (dp[i] + 1));
  printf("%I64d\n", (ans));
  return 0;
}
