#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
const int M = 1000000007;
const int N = 3e5+9;
const int INF = 2e9+1;
const int MAXN = 100000;
const int LINF = 2000000000000000001;
//_ ***************************** START Below *******************************
//* Child BFS :
//* Visited marked in child
//* Each Node visited once only i.e. queue contains distinct
//* 1
//* / | \
//* 2 5 6
//* | | /
//* 3 -- 4
//* 4's is 1st explored by 5 i.e. put in queue (visited)
//* lvl[4] = 2
//* dp[4] = dp[5] + 1
//* 4's 2nd visit => can't be explored by 6 (already visited)
//* But can be checked for shortest path
//* lvl[6] + 1 == lvl[4] i.e. shortest path
//* dp[4] = dp[6] + 1
//* 4's 3rd visit => can't be explored by 3 (already visited)
//* But can be checked for shortest path
//* lvl[3] + 1 > lvl[4] i.e. not shortest path
vector<vector<int>> graph;
void consistency(int n, int m){
vector<int> dp(n+1, 0);
queue<int> q;
q.push(1);
vector<int> visited(n+1, false);
vector<int> levels(n+1, 0);
dp[1] = 1;
visited[1] = true;
while(!q.empty()){
auto node = q.front(); q.pop();
for(int ch : graph[node]){
if(ch == node) continue;
if(visited[ch]){
//* 2nd time visit (may not be via shortest path, need to check)
//* Child is already visited and present in queue (to be explored)
//* So we don't explore it (i.e. no q.push(ch) )
if(levels[node]+1 == levels[ch]){
dp[ch] += dp[node];
}
}
else{
//* 1st time visit => gurantees to be shortest (child bfs)
q.push(ch);
visited[ch] = true;
levels[ch] = levels[node]+1;
dp[ch] += dp[node];
}
}
}
for(int i=1; i<=n; i++){
cout << dp[i] << " ";
}cout << endl;
}
void solve() {
int n, m;
cin >> n >> m;
graph.resize(n+1); // 1 based indexing
for(int i=0; i<m; i++){
int x, y;
cin >> x >> y;
graph[x].push_back(y);
graph[y].push_back(x);
}
consistency(n, m);
}
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int t = 1;
while (t--) {
solve();
}
return 0;
}