#include <bits/stdc++.h>
using namespace std;
template <typename TH>
void debug_vars(const char* data, TH head) {
  cerr << data << "=" << head << "\n";
}
template <typename TH, typename... TA>
void debug_vars(const char* data, TH head, TA... tail) {
  while (*data != ',') cerr << *data++;
  cerr << "=" << head << ",";
  debug_vars(data + 1, tail...);
}
const int MAX = 100010;
vector<int> G[MAX];
vector<long long> d;
vector<long long> dist;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  d.assign(n, 0);
  dist.assign(n, 1);
  int u, v;
  for (int i = 0; i < m; ++i) {
    cin >> u >> v;
    u--;
    v--;
    G[u].push_back(v);
    G[v].push_back(u);
    d[u]++;
    d[v]++;
  }
  long long ans = d[0];
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < ((int)(G[i]).size()); ++j) {
      if (i > G[i][j]) {
        dist[i] = max(dist[i], dist[G[i][j]] + 1);
        ans = max(ans, dist[i] * d[i]);
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
