#include <bits/stdc++.h>
using namespace std;
int N, M;
vector<vector<int> > G;
vector<long long> cnt;
vector<long long> dp;
int main(int argc, char const* argv[]) {
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    G.push_back(vector<int>());
    cnt.push_back(0);
    dp.push_back(1);
  }
  for (int i = 0; i < M; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    cnt[u]++;
    cnt[v]++;
    if (u >= v) {
      swap(u, v);
    }
    G[u].push_back(v);
  }
  long long res = 0;
  for (int i = 0; i < N; i++) {
    const auto& es = G[i];
    res = max(res, dp[i] * cnt[i]);
    for (int j : es) {
      dp[j] = max(dp[j], dp[i] + 1);
    }
  }
  cout << res << endl;
}
