#include <bits/stdc++.h>
using namespace std;
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return __builtin_popcount(s);
}
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
int n, m;
vector<int> V[400005];
long long d[400005], f[400005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  memset(d, 0, sizeof(d));
  for (int run = 0; run < (m); ++run) {
    int u, v;
    cin >> u >> v;
    V[u].push_back(v);
    V[v].push_back(u);
    d[u]++;
    d[v]++;
  }
  long long res = 0;
  for (int i = (1); i <= (n); ++i) f[i] = 1;
  for (int i = (1); i <= (n); ++i) {
    res = max(res, f[i] * d[i]);
    for (int j = 0; j < (((int)(V[i]).size())); ++j) {
      int u = V[i][j];
      if (u > i) f[u] = max(f[u], f[i] + 1);
    }
  }
  cout << res << endl;
  return 0;
}
