#include <bits/stdc++.h>
using namespace std;
vector<int> v[100009];
int main() {
  int n, m, a, b, i;
  scanf("%d %d", &n, &m);
  for (i = 1; i <= m; i++) {
    scanf("%d %d", &a, &b);
    v[a].push_back(b);
    v[b].push_back(a);
  }
  long long int arr[100009] = {0}, ans = 0;
  for (i = 1; i <= n; i++) {
    int len = v[i].size();
    for (int j = 0; j < len; j++)
      if (v[i][j] < i) {
        if (arr[i] < arr[v[i][j]]) arr[i] = arr[v[i][j]];
      }
    arr[i]++;
  }
  for (i = 0; i <= n; i++) ans = max(ans, arr[i] * (long long int)v[i].size());
  printf("%I64d", ans);
  return 0;
}
