#include <bits/stdc++.h>
const double PI = acos(-1.0);
using namespace std;
int n, m, u, v;
vector<int> arr[100117];
int len[100117];
long long ans;
int main() {
  scanf("%d%d", &n, &m);
  while (m--) {
    scanf("%d%d", &u, &v);
    arr[u].push_back(v);
    arr[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (((int)(arr[i]).size()) && len[i] == 0) {
      len[i] = 1;
      ans = max(ans, (long long)((int)(arr[i]).size()));
    }
    for (int j = 0; j < ((int)(arr[i]).size()); j++) {
      if (arr[i][j] > i) {
        len[arr[i][j]] = max(len[arr[i][j]], len[i] + 1);
        ans = max(ans,
                  (long long)len[arr[i][j]] * ((int)(arr[arr[i][j]]).size()));
      }
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
