#include <bits/stdc++.h>
using namespace std;
void swap(int &a, int &b) {
  int t;
  t = a;
  a = b;
  b = t;
}
struct pnt {
  int num;
  pnt *next;
} * p[100009], *t1;
long long tail[100009], spine[100009], ans[100009];
int main() {
  ios::sync_with_stdio(false);
  int n, m, u, v;
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    p[i] = new (pnt), p[i]->num = -1, p[i]->next = NULL, tail[i] = 1,
    spine[i] = 0;
  for (int i = 1; i <= m; i++) {
    cin >> u >> v;
    if (u > v) swap(u, v);
    t1 = new (pnt);
    t1->num = v;
    t1->next = p[u];
    p[u] = t1;
  }
  for (int i = 1; i <= n; i++) {
    t1 = p[i];
    while (t1->num != -1) {
      spine[i]++;
      spine[t1->num]++;
      tail[t1->num] = max(tail[t1->num], tail[i] + 1);
      t1 = t1->next;
      if (t1->next == NULL) break;
    }
  }
  for (int i = 1; i <= n; i++) ans[i] = tail[i] * spine[i];
  long long a2 = 0;
  for (int i = 1; i <= n; i++)
    if (ans[i] > a2) a2 = ans[i];
  cout << a2;
  return 0;
}
