#include <bits/stdc++.h>
using namespace std;
vector<int> v[100009];
int memo[100004];
long long int ans = 0;
int dfs(int a) {
  if (memo[a] != -1) return memo[a];
  int ans = 0, l = v[a].size(), last = a;
  for (int i = 0; i < l; i++)
    if (v[a][i] < a) {
      int p = dfs(v[a][i]);
      ans = max(ans, p);
    }
  return memo[a] = ans + 1;
  ;
}
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);
  }
  for (i = 0; i <= 100000; i++) memo[i] = -1;
  long long int ans = 0, t, pans;
  for (i = 1; i <= n; i++) {
    int p;
    p = dfs(i);
    ans = max(ans, (long long int)p * (long long int)v[i].size());
  }
  printf("%I64d", ans);
  return 0;
}
