#include <bits/stdc++.h>
using namespace std;
struct data {
  int y, next;
} road[400010];
int n, m, head[100010], du[100010], x, y, p, dis[100010];
long long f[100010], ans;
void build(int x, int y) {
  road[++p].y = y;
  road[p].next = head[x];
  head[x] = p;
}
void dfs(int x) {
  if (dis[x]) return;
  dis[x] = 1;
  for (int i = head[x]; i; i = road[i].next) {
    int to = road[i].y;
    if (to < x) {
      dfs(to);
      if (dis[to] + 1 > dis[x]) dis[x] = dis[to] + 1;
    }
  }
  f[x] = (long long)dis[x] * du[x];
}
void solve() {
  ans = 0ll;
  for (int i = 1; i <= n; ++i) {
    dfs(i);
    if (f[i] > ans) ans = f[i];
  }
  cout << ans;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    cin >> x >> y;
    du[x]++;
    du[y]++;
    build(x, y);
    build(y, x);
  }
  solve();
  return 0;
}
