#include <bits/stdc++.h>
using namespace std;
int nextint() {
  int x = 0, c;
  do {
    c = getchar();
  } while (!isdigit(c));
  do {
    x = x * 10 + c - '0';
  } while (isdigit(c = getchar()));
  return x;
}
const int maxn = 100000 + 5;
vector<int> edges[maxn];
int d[maxn];
int dp(int u) {
  int &ans = d[u];
  if (ans) return ans;
  ans = 1;
  for (auto it = edges[u].begin(); it != edges[u].end(); ++it) {
    if (*it < u) ans = max(ans, dp(*it) + 1);
  }
  return ans;
}
int main() {
  int n = nextint(), m = nextint();
  while (m--) {
    int u = nextint(), v = nextint();
    edges[u].push_back(v);
    edges[v].push_back(u);
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    long long buf = dp(i) * 1LL * edges[i].size();
    if (buf > ans) ans = buf;
  }
  cout << ans << endl;
}
