#include "bits/stdc++.h"
const int N = 1e5 + 10;
int n, k;
int fa[N], a[N];
std::vector<int> to[N];
std::set<int> circle[N];
int find(int x) {
return x == fa[x] ? x : fa[x] = find(fa[x]);
}
int main() {
freopen("dance.in", "r", stdin);
freopen("dance.out", "w", stdout);
for (int i = 1; i < N; ++ i) {
fa[i] = a[i] = i;
to[i].push_back(i);
}
std::cin >> n >> k;
for (int i = 1; i <= k; ++ i) {
int x, y;
std::cin >> x >> y;
std::swap(a[x], a[y]);
to[a[x]].push_back(y),
to[a[y]].push_back(x);
}
for (int i = 1; i <= n; ++ i) {
fa[find(i)] = find(a[i]);
}
for (int i = 1; i <= n; ++ i) {
for (auto v : to[i])
circle[find(i)].insert(v);
}
for (int i = 1; i <= n; ++ i) {
std::cout << circle[find(i)].size() << '\n';
}
return 0;
}