#include <bits/stdc++.h>
using namespace std;
long long N, M;
vector<long long> graph[100000], rgraph[100000];
long long sum[100000];
bool used[100000];
vector<long long> order;
long long dp[100000];
void dfs(long long idx) {
  if (used[idx]++) return;
  for (long long i = 0; i < graph[idx].size(); i++) {
    dfs(graph[idx][i]);
  }
  order.push_back(idx);
}
signed main() {
  cin >> N >> M;
  for (long long i = 0; i < M; i++) {
    long long U, V;
    cin >> U >> V;
    --U, --V;
    if (U > V) swap(U, V);
    graph[U].push_back(V);
    rgraph[V].push_back(U);
    sum[V]++;
    sum[U]++;
  }
  long long ret = 0;
  queue<long long> que;
  for (long long i = 0; i < N; i++) {
    dfs(i);
  }
  reverse(order.begin(), order.end());
  for (long long i = 0; i < order.size(); i++) {
    long long u = order[i];
    dp[u] = 1;
    for (long long j = 0; j < rgraph[u].size(); j++) {
      dp[u] = max(dp[u], dp[rgraph[u][j]] + 1);
    }
    ret = max(ret, 1LL * dp[u] * sum[u]);
  }
  cout << ret << endl;
}
