#include <bits/stdc++.h>
using namespace std;
const int MN = 100010;
vector<long long> tail(MN), spines(MN);
vector<int> g[MN];
int dfs(int s) {
  if (tail[s] > 0) return tail[s];
  int ans = 0;
  for (auto &u : g[s]) ans = max(ans, dfs(u));
  return tail[s] = ans + 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    if (v < u) swap(u, v);
    g[v].push_back(u);
    spines[u]++;
    spines[v]++;
  }
  for (int i = n; i >= 1; i--) dfs(i);
  long long ans = 1;
  for (int i = 1; i <= n; i++) ans = max(ans, tail[i] * spines[i]);
  cout << ans << endl;
  return 0;
}
