#include <bits/stdc++.h>
using namespace std;
int n, m;
int dp[100003];
int cnt[100003];
vector<int> adj[100003];
int f(int node) {
  if (dp[node]) return dp[node];
  dp[node] = 1;
  for (int i = 0; i < adj[node].size(); i++)
    dp[node] = max(dp[node], f(adj[node][i]) + 1);
  return dp[node];
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0, x, y; i < m; i++) {
    scanf("%d%d", &x, &y);
    cnt[x]++;
    cnt[y]++;
    if (x > y) swap(x, y);
    adj[y].push_back(x);
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++)
    ans = max(ans, (long long)cnt[i] * (long long)f(i));
  printf("%I64d\n", ans);
}
