#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
const int mod = (int)1e9 + 7;
const int N = 1e5 + 10;
const long long inf = -1e9;
const int maxm = 1005;
vector<vector<char>> matrix(maxm, vector<char>(maxm));
vector<vector<bool>> vt(maxm, vector<bool>(maxm));
struct event {
  int x, y, size;
};
int dx[] = {0, 0, 1, -1};
int dy[] = {-1, 1, 0, 0};
struct myComp {
  constexpr bool operator()(pair<int, int> const& a,
                            pair<int, int> const& b) const noexcept {
    return a.first < b.first;
  }
};
vector<int> g[N];
void solve() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  vector<long long> dp(n + 1);
  long long ans = 0;
  for (int v = 1; v <= n; v++) {
    dp[v] = 1;
    for (auto u : g[v]) {
      if (u < v) dp[v] = max(dp[v], dp[u] + 1);
    }
    ans = max(ans, dp[v] * (long long)int(g[v].size()));
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
