mod=1000000007 class UnionFind: def __init__(self,n): self.par=[-1 for i in range(n)] self.ans=[1 for i in range(n)] self.st=[{i} for i in range(n)] def find(self,x): if self.par[x]<0: return x else: self.par[x]=self.find(self.par[x]) return self.par[x] def unite(self,x,y): x=self.find(x) y=self.find(y) if x!=y: if self.par[x]>self.par[y]: x,y=y,x if self.par[x]==self.par[y]: for i in self.st[x]: self.ans[i]*=500000004 self.ans[i]%=mod for i in self.st[y]: self.ans[i]*=500000004 self.ans[i]%=mod else: for i in self.st[y]: self.ans[i]=0 self.st[x]|=self.st[y] self.par[x]+=self.par[y] self.par[y]=x N,M=map(int,input().split()) UF=UnionFind(N) for i in range(M): A,B=map(int,input().split()) UF.unite(A-1,B-1) for i in range(N): print(UF.ans[i])