#include <bits/stdc++.h>
using namespace std;
const int kMaxN = 1e5 + 11;
int N, M;
vector<int> adj[kMaxN];
int mxlen[kMaxN], deg[kMaxN];
int main() {
  scanf("%d %d", &N, &M);
  for (int i = 0; i < M; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    --a, --b;
    if (a > b) swap(a, b);
    adj[a].push_back(b);
    ++deg[a], ++deg[b];
  }
  for (int here = 0; here < N; ++here) {
    mxlen[here] = max(mxlen[here], 1);
    for (int i = 0; i < adj[here].size(); ++i) {
      int there = adj[here][i];
      mxlen[there] = max(mxlen[there], mxlen[here] + 1);
    }
  }
  long long ans = 0;
  for (int i = 0; i < N; ++i) {
    ans = max(ans, (long long)deg[i] * mxlen[i]);
  }
  printf("%lld\n", ans);
  return 0;
}
