#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const int N = 1e6 + 1, mod = 1e9 + 7;
int n, m, root, ans = 0, ans2 = 0;
int u[N], v[N], h[N], f[N], sz[N], up[N], par[N], sum[N];
vector<int> adj[N];
map<pair<int, int>, bool> meme;
vector<pair<int, int>> back_edge;
void dfs(int v, int p) {
  par[v] = p;
  for (auto u : adj[v]) {
    if (u == p) {
      continue;
    }
    if (h[u] == 0) {
      h[u] = h[v] + 1;
      dfs(u, v);
    } else if (h[u] < h[v]) {
      back_edge.push_back({u, v});
    }
  }
}
int union_find(int v) {
  if (up[v] == v) {
    return v;
  }
  return union_find(up[v]);
}
void union_merge(int u, int v) {
  int uwu = union_find(u), ovo = union_find(v);
  if (sz[uwu] > sz[ovo]) {
    swap(uwu, ovo);
  }
  if (uwu != ovo) {
    up[uwu] = ovo;
    sz[ovo] += sz[uwu];
  }
}
void visit(int v, int p) {
  for (auto u : adj[v]) {
    if (u == p) {
      continue;
    }
    visit(u, v);
    sum[v] += sum[u];
  }
  ans2 += sz[v] * sum[v] + sz[v] * (sz[v] - 1);
  sum[v] += sz[v];
}
int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int &u = ::u[i], &v = ::v[i];
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(h[1] = 1, 0);
  for (int i = 1; i <= n; i++) {
    up[i] = i;
    sz[i] = 1;
  }
  for (auto cur : back_edge) {
    int u = cur.first, v = cur.second;
    union_merge(u, v);
    while (h[u] < h[v]) {
      union_merge(v, par[v]);
      v = par[v];
    }
  }
  for (int i = 1; i <= n; i++) {
    adj[i].clear();
  }
  for (int i = 1; i <= m; i++) {
    int u = union_find(::u[i]), v = union_find(::v[i]);
    if (u == v) {
      continue;
    }
    if (u > v) {
      swap(u, v);
    }
    meme[{u, v}] = 0;
  }
  for (auto cur : meme) {
    int u = cur.first.first, v = cur.first.second;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  memset(h, 0, sizeof h);
  for (int i = 1; i <= n; i++) {
    int v = union_find(i);
    if (!h[v]) {
      h[v] = 1;
      ans2 = 0;
      memset(sum, 0, sizeof sum);
      visit(v, 0);
      memset(f, 0, sizeof f);
      f[0] = 1;
      ans = max(ans, ans2);
      for (auto u : adj[v]) {
        for (int s = n; s >= 0; s--) {
          if (f[s]) {
            int x = s + sum[u];
            f[x] = 1;
            ans = max(ans, ans2 + x * (n - x - sz[v]));
          }
        }
      }
    }
  }
  cout << ans + n;
}
