#include <bits/stdc++.h>
using namespace std;
struct Node {
  int id;
  vector<Node*> neighbours;
  Node(int i) : id(i) {}
};
int main() {
  int n, m;
  cin >> n >> m;
  vector<Node*> nodes;
  for (int i = 0; i < n; i++) {
    nodes.push_back(new Node(i));
  }
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    nodes[x - 1]->neighbours.push_back(nodes[y - 1]);
    nodes[y - 1]->neighbours.push_back(nodes[x - 1]);
  }
  unsigned long long ans = 0;
  vector<int> dp(n, 0);
  for (Node* x : nodes) {
    dp[x->id] = 1;
    for (Node* y : x->neighbours) {
      dp[x->id] = max(dp[x->id], dp[y->id] + 1);
    }
    ans = max(ans, dp[x->id] * (unsigned long long)x->neighbours.size());
  }
  cout << ans << endl;
  return 0;
}
