#include <bits/stdc++.h>
using namespace std;
int visited[100010], cnt[100010], dp[100010], n, m;
std::vector<int> v[100010];
int dfs(int x) {
  if (visited[x]) return visited[x];
  for (int i = 0; i < v[x].size(); i++) {
    visited[x] = max(visited[x], dfs(v[x][i]));
  }
  visited[x]++;
  return visited[x];
}
int main() {
  int a, b;
  long long ans = 0;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &a, &b);
    if (a > b) swap(a, b);
    cnt[a]++;
    cnt[b]++;
    v[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    dfs(i);
    ans = max(ans, (long long)visited[i] * cnt[i]);
  }
  printf("%lld\n", ans);
  return 0;
}
