#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int block_size = 360;
const int maxn = 100010;
const long long mod = 1e9 + 7;
const long double eps = 1e-9;
template <typename T>
int sign(const T& a) {
  if (a < 0) {
    return -1;
  }
  if (a > 0) {
    return 1;
  }
  return 0;
}
long long cross_product(const complex<long long>& from, complex<long long> a,
                        complex<long long> b) {
  a -= from;
  b -= from;
  return a.imag() * b.real() - a.real() - b.imag();
}
vector<int> adj[maxn];
int n, m;
int dp[maxn];
void read() {
  scanf("%d", &n);
  scanf("%d", &m);
  for (long long i = 0; i < m; i++) {
    int a, b;
    scanf("%d", &a);
    scanf("%d", &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
}
void solve() {
  for (long long i = 1; i < n + 1; i++) {
    for (long long j = 0; j < adj[i].size(); j++) {
      if (adj[i][j] < i) {
        dp[i] = max(dp[i], dp[adj[i][j]] + 1);
      }
    }
  }
  long long ans = 0;
  for (long long i = 1; i < n + 1; i++) {
    ans = max(ans, (long long)(1LL * (dp[i] + 1) * adj[i].size()));
  }
  cout << ans;
}
int main() {
  read();
  solve();
  return 0;
}
