#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const int inf = 0x20202020;
const int N = 100005;
struct edge {
  int u, v, nxt;
} e[400005];
int b[N];
int n, m;
int dp[N], deg[N], en = 0;
void addedge(int u, int v) {
  e[++en].v = v;
  e[en].nxt = b[u];
  b[u] = en;
}
int main() {
  memset(b, -1, sizeof(b));
  memset(deg, 0, sizeof(deg));
  cin >> n >> m;
  int u, v;
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &u, &v);
    addedge(u, v);
    addedge(v, u);
    deg[u]++;
    deg[v]++;
  }
  for (int i = 1; i <= n; i++) dp[i] = 1;
  for (int i = 1; i <= n; i++) {
    for (int p = b[i]; ~p; p = e[p].nxt)
      if (e[p].v > i) dp[e[p].v] = max(dp[e[p].v], dp[i] + 1);
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++)
    ans = max(ans, (long long)dp[i] * (long long)deg[i]);
  cout << ans;
  return 0;
}
