#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
int n, m, spi[N], dis[N];
vector<int> gra[N];
int f(int v) {
  int &res = dis[v];
  if (res) return res;
  res = 1;
  for (auto &(to) : (gra[v])) {
    (res) = max((res), (f(to) + 1));
  }
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  scanf("%d%d", &n, &m);
  for (int i = 0; i < (int)m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    u--;
    v--;
    spi[u]++;
    spi[v]++;
    if (u < v) swap(u, v);
    gra[u].push_back(v);
  }
  long long ans = 0;
  for (int i = 0; i < (int)n; ++i) {
    (ans) = max((ans), (1ll * f(i) * spi[i]));
  }
  printf("%I64d\n", ans);
}
