#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
vector<int> G[maxn];
int len[maxn], num[maxn];
int main() {
  int n, m, u, v;
  while (cin >> n >> m) {
    for (int i = 1; i <= n; i++) {
      G[i].clear();
      len[i] = 1;
      num[i] = 0;
    }
    for (int i = 0; i < m; i++) {
      scanf("%d%d", &u, &v);
      if (u > v)
        G[u].push_back(v);
      else
        G[v].push_back(u);
      num[u]++;
      num[v]++;
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 0; j < G[i].size(); j++) {
        v = G[i][j];
        len[i] = max(len[i], len[v] + 1);
      }
    }
    long long ans = 0;
    for (int i = n; i >= 1; i--) ans = max(ans, (long long)num[i] * len[i]);
    cout << ans << endl;
  }
  return 0;
}
