#include<bits/stdc++.h>
usingnamespacestd;#define int long long
constintN=5e5+5;intn,m;vector<int>G[N];intdfn[N],low[N],tim,sz[N],ans[N];voidtarjan(intu){dfn[u]=low[u]=++tim;sz[u]=1;intsiz=0;for(intv:G[u]){if(!dfn[v]){tarjan(v);sz[u]+=sz[v];low[u]=min(low[u],low[v]);if(low[v]>=dfn[u]){ans[u]+=sz[v]*siz;siz+=sz[v];}}elselow[u]=min(low[u],dfn[v]);}ans[u]+=(n-siz-1)*siz+n-1;}signedmain(){ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);cin>>n>>m;for(inti=1,u,v;i<=m;i++){cin>>u>>v;G[u].push_back(v);G[v].push_back(u);}tarjan(1);for(inti=1;i<=n;i++)cout<<ans[i]*2<<"\n";return0;}