#include <bits/stdc++.h>
using namespace std;
long long int n, m;
vector<long long int> nb[100005];
long long int dp1[100005], dp2[100005];
int main() {
  cin >> n >> m;
  long long int a, b;
  for (long long int i = 0; i < m; ++i) {
    cin >> a >> b;
    nb[a].push_back(b);
    nb[b].push_back(a);
  }
  long long int ans = nb[1].size();
  dp1[1] = 1;
  for (long long int i = 2; i <= n; ++i) {
    dp2[i] = nb[i].size();
    dp1[i] = 1;
    for (long long int j = 0; j < nb[i].size(); ++j) {
      if (nb[i][j] < i) dp1[i] = max(dp1[i], (1 + dp1[nb[i][j]]));
    }
    ans = max(ans, (dp1[i] * dp2[i]));
  }
  cout << ans;
}
