#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 1;
vector<int> graph[maxn];
long long dp[maxn], cnt[maxn];
int main() {
  int n, m;
  cin >> n >> m;
  int u, v;
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    graph[u].push_back(v);
    graph[v].push_back(u);
    cnt[u]++;
    cnt[v]++;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    for (unsigned int j = 0; j < graph[i].size(); j++)
      dp[i] = max(dp[i], dp[graph[i][j]]);
    dp[i]++;
    ans = max(ans, dp[i] * cnt[i]);
  }
  cout << ans << endl;
}
