#include <bits/stdc++.h>
using namespace std;
void task();
int main() {
  task();
  return 0;
}
const int N = (int)2e5 + 10;
const long long int MODULO = (long long int)1e9 + 7;
const int INF = 1 << 30;
const long long int LINF = (long long int)8e18 + 100;
const int BUF_SIZE = (int)1e4 + 10;
int n, m;
vector<int> g[N];
int dp[N];
void task() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  fill(dp, dp + n + 1, 1);
  for (int i = 1; i < n + 1; ++i) {
    for (auto to : g[i]) {
      if (i < to) {
        dp[to] = max(dp[to], dp[i] + 1);
      }
    }
  }
  long long int ans = 0;
  for (int i = 1; i < n + 1; ++i) {
    ans = max(ans, (long long int)dp[i] * (long long int)g[i].size());
  }
  printf("%I64d", ans);
}
