#include <bits/stdc++.h>
using namespace std;
using namespace std;
long long n, m, a, b;
int freq[1000000];
int dp[1000000];
vector<vector<int> > v(200001);
int solve(int x) {
  int &ret = dp[x];
  if (ret != -1) return ret;
  ret = 1;
  for (int i = 0; i < v[x].size(); i++)
    if (v[x][i] < x) ret = max(1 + solve(v[x][i]), ret);
  return ret;
}
int main() {
  memset(dp, -1, sizeof(dp));
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
    freq[a]++;
    freq[b]++;
  }
  long long mx = -LLONG_MAX;
  for (int i = 1; i <= n; i++) {
    mx = max((long long)freq[i] * max(0, solve(i)), mx);
  }
  cout << mx << endl;
}
