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