import java.io.*;
import java.util.*;
public class P1144 {
static int maxN =1000005 ;
static int maxM =2000005;
static int mod = 100003;
static List<Integer> list[] = new ArrayList[maxM];
static int cnt[] = new int[maxN];
static int dis[] = new int[maxN];
static boolean isVis[]= new boolean[maxN];
static PriorityQueue<Edge> pq = new PriorityQueue<Edge>();
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int N = Integer.parseInt(st.nextToken());
int M = Integer.parseInt(st.nextToken());
for(int i = 1;i <= N;i++){
list[i] = new ArrayList<Integer>();
}
Arrays.fill(cnt, 0);
Arrays.fill(dis, Integer.MAX_VALUE);
Arrays.fill(isVis, false);
pq.clear();
for(int i = 1;i <= M;i++){
st = new StringTokenizer(br.readLine());
int x = Integer.parseInt(st.nextToken());
int y = Integer.parseInt(st.nextToken());
list[x].add(y);
list[y].add(x);
}
dis[1] = 0;
cnt[1] = 1;
pq.add(new Edge(1,0));
while(!pq.isEmpty()){
Edge cur = pq.poll();
if(!isVis[cur.index]){
isVis[cur.index] = true;
for(int i = 0;i < list[cur.index].size();i++){
int next = list[cur.index].get(i);
if(dis[next] == cur.weight + 1){
cnt[next] += cnt[cur.index];
cnt[next] %= mod;
}
if(dis[next] > cur.weight + 1){
dis[next] = cur.weight + 1;
cnt[next] = cnt[cur.index];
pq.add(new Edge(next,dis[next]));
}
}
}
}
for(int i = 1;i <= N;i ++){
System.out.println(cnt[i]);
}
}
static class Edge implements Comparable<Edge>{
int index;
int weight;
public Edge(int index, int weight) {
super();
this.index = index;
this.weight = weight;
}
public int compareTo(Edge o) {
return this.weight - o.weight;
}
}
}