#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10, maxm = 2 * 1e5 + 10;
vector<int> hamsaye[maxn];
int n, m, dp[maxn];
long long max_point;
void find_longest_tail() {
  dp[1] = 0;
  bool check;
  for (int i = 2; i <= n; i++) {
    check = true;
    for (int j = 0; j < hamsaye[i].size(); j++) {
      if (hamsaye[i][j] < i && check) {
        dp[i] = dp[hamsaye[i][j]] + 1;
        check = false;
      } else if (hamsaye[i][j] < i) {
        dp[i] = max(dp[i], dp[hamsaye[i][j]] + 1);
      }
    }
  }
}
void find_answer() {
  for (int i = 1; i <= n; i++) {
    max_point = max(max_point, (dp[i] + 1) * (long long)hamsaye[i].size());
  }
  cout << max_point;
}
int main() {
  cin >> n >> m;
  int u, v;
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    hamsaye[u].push_back(v);
    hamsaye[v].push_back(u);
  }
  find_longest_tail();
  find_answer();
  return 0;
}
