#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int res = 0;
  char c;
  int f = 1;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') f = -1;
  while (c >= '0' && c <= '9') res = res * 10 + c - '0', c = getchar();
  return res * f;
}
const int N = 100010;
long long num[N], rd[N];
long long ans;
pair<int, int> a[N << 1];
int main() {
  int n = in(), m = in();
  for (int i = 1; i <= n; i++) {
    num[i] = 1;
  }
  for (int i = 0; i < m; i++) {
    a[i].first = in();
    a[i].second = in();
  }
  sort(a, a + m);
  for (int i = 0; i < m; i++) {
    int x = a[i].first, y = a[i].second;
    if (x > y) {
      num[x] = max(num[x], num[y] + 1);
    } else {
      num[y] = max(num[y], num[x] + 1);
    }
    rd[x]++;
    rd[y]++;
  }
  for (int i = 1; i <= n; i++) {
    ans = max(ans, 1LL * num[i] * rd[i]);
  }
  cout << ans << endl;
  return 0;
}
