#include <bits/stdc++.h>
using namespace std;
const int N=100000+5;
int n,k,r=0;
int a[N],b[N],id[N],cnt=0;
bool vis[N],has[N];
int ans[N]={0};
vector<int>v[N];
void dfs(int pt){
id[pt]=cnt;vis[pt]=1;
for (int i=0;i<v[pt].size();i++){
int x=v[pt][i];
if (!has[x]){
has[x]=1;ans[cnt]++;
}
if (!vis[b[pt]])dfs(b[pt]);
}
return ;
}
int main(){
freopen ("dance.in","r",stdin);
freopen ("dance.out","w",stdout);
scanf("%d%d",&n,&k);
for (int i=1;i<=n;i++){
b[i]=a[i]=i;
v[b[i]].push_back(i);
}
for (int i=1;i<=k;i++){
int x,y;scanf("%d%d",&x,&y);
v[b[x]].push_back(y);
v[b[y]].push_back(x);
swap(b[x],b[y]);
}
for (int i=1;i<=n;i++){
if (!vis[i]){
memset(has,0,sizeof(has));
cnt++;
dfs(i);
}
}
for (int i=1;i<=n;i++)printf("%d\n",ans[id[i]]);
return 0;
}