#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 1e18;
const int N = 221234;
int n, m;
vector<int> G[N];
int num[N];
int cnt[N];
int main() {
  while (scanf("%d%d", &n, &m) != EOF) {
    int i, j;
    memset(num, 0, sizeof(num));
    for (i = 1; i <= n; ++i) G[i].clear();
    memset(cnt, 0, sizeof(cnt));
    while (m--) {
      int u, v;
      scanf("%d%d", &u, &v);
      if (u < v) swap(u, v);
      G[u].push_back(v);
      cnt[u]++;
      cnt[v]++;
    }
    long long ans = 0;
    for (i = 1; i <= n; ++i) {
      num[i] = 1;
      for (j = 0; j < G[i].size(); ++j) {
        num[i] = max(num[i], num[G[i][j]] + 1);
      }
      ans = max(ans, 1LL * num[i] * cnt[i]);
    }
    printf("%I64d\n", ans);
  }
}
