#include using namespace std; typedef pair PII; const int N = 100010, M = 400010; const int MOD = 100003; int n, m; int cnt[N]; int dist[N]; bool st[N]; int h[N], e[M], ne[M], idx; void add(int a, int b) { e[idx] = b, ne[idx] = h[a], h[a] = idx++; } void dijkstra() { memset(dist, 0x3f, sizeof dist); dist[1] = 0; // 出发点到自己的最短路径只能有1条 cnt[1] = 1; // 小顶堆q priority_queue, greater> pq; pq.push({0, 1}); while (pq.size()) { auto t = pq.top(); pq.pop(); int u = t.second, d = t.first; if (st[u]) continue; st[u] = true; for (int i = h[u]; ~i; i = ne[i]) { int j = e[i]; if (dist[j] > d + 1) { dist[j] = d + 1; cnt[j] = cnt[u]; pq.push({dist[j], j}); } else if (dist[j] == d + 1) cnt[j] = (cnt[j] + cnt[u]) % MOD; } } } int main() { scanf("%d %d", &n, &m); memset(h, -1, sizeof h); while (m--) { int a, b; scanf("%d %d", &a, &b); add(a, b), add(b, a); } dijkstra(); for (int i = 1; i <= n; i++) printf("%d\n", cnt[i]); return 0; }