#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using ll = long long;
using ld = long double;
const int N = 1e5 + 5;
vector<ll> g[N];
ll ans = 0, dp[N];
bitset<N> used;
void dfs(int v) {
  used[v] = 1;
  ll mxChain = 0;
  for (auto to : g[v]) {
    if (to < v) {
      mxChain = max(mxChain, dp[to]);
    }
  }
  dp[v] = 1 + mxChain;
  for (auto to : g[v]) {
    if (!used[to] && to < v) {
      dfs(to);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    g[u - 1].push_back(v - 1);
    g[v - 1].push_back(u - 1);
  }
  for (int i = 0; i < n; i++) {
    if (!used[i]) {
      dfs(i);
    }
  }
  for (int i = 0; i < n; i++) {
    ans = max(ans, dp[i] * (int)g[i].size());
  }
  cout << ans;
  return 0;
}
