#include <bits/stdc++.h>
using namespace std;
int h[2010], n, m, mn[2010], cnt[2010], dp[2010];
vector<int> g[2010], gc[2010];
bitset<2010> bt, b;
void dfs1(int np, int dep) {
  mn[np] = h[np] = dep;
  bt[np] = 1;
  for (auto &v : g[np]) {
    if (!bt[v]) dfs1(v, dep + 1);
    if (h[v] - h[np] + 1 != 0) mn[np] = min(mn[np], mn[v]);
  }
}
void dfs2(int np, int c) {
  static int col = 1;
  cnt[c]++;
  bt[np] = 1;
  for (auto &v : g[np]) {
    if (!bt[v]) {
      if (mn[v] <= h[np])
        dfs2(v, c);
      else {
        gc[c].push_back(col);
        gc[col].push_back(c);
        dfs2(v, col++);
      }
    }
  }
}
int dfs3(int np, int fath) {
  int ans = dp[np] = 0;
  for (auto &v : gc[np])
    if (v != fath) ans += dfs3(v, np), dp[np] += dp[v];
  dp[np] += cnt[np];
  ans += dp[np] * cnt[np];
  return ans;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1, ti, tj; i <= m; i++) {
    scanf("%d%d", &ti, &tj);
    ti--;
    tj--;
    g[ti].push_back(tj);
    g[tj].push_back(ti);
  }
  int ans = 0;
  dfs1(0, 0);
  bt.reset();
  dfs2(0, 0);
  for (int i = 0; cnt[i]; i++) {
    int res = dfs3(i, -1);
    b.reset();
    b.set(0);
    for (auto &v : gc[i]) b |= b << dp[v];
    for (int j = 0; j < n; j++)
      if (b[j]) ans = max(ans, res + j * (n - cnt[i] - j));
  }
  printf("%d\n", ans);
  return 0;
}
