#include <bits/stdc++.h>
using namespace std;
vector<int> v[100010];
int lg[100010], nod[100010];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (x > y) swap(x, y);
    v[x].push_back(y);
    ++nod[x];
    ++nod[y];
  }
  long long ma = 0LL;
  for (int i = 1; i <= n; ++i) {
    if (!lg[i]) lg[i] = 1;
    long long x = 1LL * lg[i] * nod[i];
    ma = max(ma, x);
    for (int j = 0; j < v[i].size(); ++j)
      lg[v[i][j]] = max(lg[v[i][j]], lg[i] + 1);
  }
  printf("%I64d\n", ma);
  return 0;
}
