#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void smax(T &x, T y) {
  x = max((x), (y));
}
template <class T>
inline void smin(T &x, T y) {
  x = min((x), (y));
}
inline void sc(int &x) {
  bool f = 0;
  x = 0;
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') {
    f = 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  if (f) x = -x;
  return;
}
void sc(char &x) { scanf("%c", &x); }
void sc(int &x, int &y) {
  sc(x);
  return sc(y);
}
void sc(int &x, int &y, int &z) {
  sc(x);
  sc(y);
  return sc(z);
}
const double eps = 1e-7;
int n, k, a, b;
vector<int> inp[2000005];
char str[2000005];
map<int, int> V;
long long ans = 0;
int dfs(int from, int len = 1) {
  if (V[from])
    return V[from];
  else {
    int max_len = 0;
    for (long long i = 0; i < int((inp[from]).size()); i++) {
      if (inp[from][i] < from) {
        smax(max_len, dfs(inp[from][i]));
      }
    }
    V[from] = max_len + 1;
    return max_len + 1;
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  int n, m;
  sc(n, m);
  for (long long i = 0; i < m; i++) {
    sc(a, b);
    inp[a].push_back(b);
    inp[b].push_back(a);
  }
  for (int i = 1; i < n + 1; i++) {
    dfs(i);
  }
  for (auto el : V) {
    smax(ans, (long long)el.second * int((inp[el.first]).size()));
  }
  cout << ans << endl;
  return 0;
}
