#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
long long n, m, sequ[maxn];
vector<int> adj[maxn];
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < adj[i].size(); j++) {
      int u = adj[i][j];
      if (u > i) {
        sequ[u] = max(sequ[u], sequ[i] + 1);
      }
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int siz = adj[i].size();
    ans = max(ans, (sequ[i] + 1) * siz);
  }
  cout << ans;
}
