#include <iostream>
#include <queue>
#include <stdio.h>
using namespace std;
int a[2000006];
int b[2000006];
int N;
int M;
int num[1000006] = { 0 };
int dist[1000006] = { 0 };
queue<int>q;
void bfs()
{
q.push(1);
while (!q.empty())
{
int e1 = q.front();
q.pop();
for (int i = 0; i < M; i++)
{
if (a[i] == e1 || b[i] == e1)
{
int e2 = (b[i] == e1) ? a[i] : b[i];
if (dist[e2] == 0 && e2 != 1)
{
dist[e2] = dist[e1] + 1;
q.push(e2);
num[e2] = (num[e2] + num[e1]) % 100003;
}
else if (dist[e2] == dist[e1] + 1)
{
num[e2] = (num[e2] + num[e1]) % 100003;
}
}
}
}
}
int main()
{
cin >> N >> M;
for (int i = 0; i < M; i++)
{
cin >> a[i] >> b[i];
}
num[1] = 1;
dist[1] = 0;
bfs();
for (int i = 1; i <= N; i++)
{
cout << num[i] << endl;
}
return 0;
}