#include <bits/stdc++.h>
using namespace std;
int fastMax(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ y; }
int fastMin(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ x; }
const long long int N = 1e5 + 5;
long long int n, m, ans = 0;
long long int dp[N], deg[N];
vector<long long int> graph[N];
void solve() {
  cin >> n >> m;
  for (int i = (1); i <= (m); ++i) {
    long long int u, v;
    cin >> u >> v;
    deg[u]++, deg[v]++;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  for (int i = (1); i <= (n); ++i) dp[i] = 1;
  for (int i = (1); i <= (n); ++i) {
    for (long long int v : graph[i]) {
      if (v < i) continue;
      dp[v] = max(dp[v], dp[i] + 1);
    }
    ans = max(ans, dp[i] * deg[i]);
  }
  cout << ans << endl;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t;
  t = 1;
  while (t--) solve();
}
