#include <bits/stdc++.h>
using namespace std;
int ans[100005];
vector<int> adj[100005];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  long long maxi = 0;
  for (int i = 1; i <= n; i++) {
    ans[i] = 1;
    for (int j = 0; j < adj[i].size(); j++) {
      if (adj[i][j] < i) ans[i] = max(ans[i], ans[adj[i][j]] + 1);
    }
    maxi = max(maxi, ans[i] * (long long)adj[i].size());
  }
  printf("%I64d\n", maxi);
}
