#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f, mod = 1e9 + 7;
const double PI = acos(-1), EPS = 1e-8;
int dr[]{-1, -1, 0, 1, 1, 1, 0, -1};
int dc[]{0, 1, 1, 1, 0, -1, -1, -1};
void run() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
const int N = 2e5 + 10;
vector<vector<int>> adj;
int mem[N];
int main() {
  run();
  int n, m;
  cin >> n >> m;
  adj = vector<vector<int>>(n + 1);
  memset(mem, 0, sizeof(mem));
  while (m--) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    for (int j : adj[i])
      if (j > i) mem[j] = max(mem[j], mem[i] + 1);
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = max(ans, (long long)(adj[i].size()) * (mem[i] + 1));
  }
  return cout << ans, 0;
}
