#include <bits/stdc++.h>
using namespace std;
int n, m;
const int MAXN = 100005;
int64_t dp[MAXN];
vector<int> Next[MAXN];
void Init(int n) {
  for (int i(0); i <= n; ++i) {
    Next[i].clear();
    dp[i] = 1;
  }
}
int main() {
  scanf("%d%d", &n, &m);
  Init(n);
  for (int i(0); i < m; ++i) {
    int from, to;
    scanf("%d%d", &from, &to);
    Next[from].push_back(to);
    Next[to].push_back(from);
  }
  for (int i(1); i <= n; ++i) {
    for (int j(0); j < Next[i].size(); ++j) {
      if (Next[i][j] > i) dp[Next[i][j]] = max(dp[Next[i][j]], dp[i] + 1);
    }
  }
  int64_t ans(0);
  for (int i(1); i <= n; ++i) {
    ans = max(ans, dp[i] * ((int64_t)Next[i].size()));
  }
  printf("%lld\n", ans);
}
