import sys input = sys.stdin.readline class Unionfind: def __init__(self, n): self.par = [-1]*n def root(self, x): r = x while not self.par[r]<0: r = self.par[r] t = x while t!=r: tmp = t t = self.par[t] self.par[tmp] = r return r def unite(self, x, y): rx = self.root(x) ry = self.root(y) if rx==ry: return if -self.par[rx]<=-self.par[ry]: self.par[ry] += self.par[rx] self.par[rx] = ry else: self.par[rx] += self.par[ry] self.par[ry] = rx def is_same(self, x, y): return self.root(x)==self.root(y) def count(self, x): return -self.par[self.root(x)] N, M = map(int, input().split()) uf = Unionfind(N) belong = [[i] for i in range(N)] ans = [1]*N MOD = 10**9+7 for _ in range(M): a, b = map(int, input().split()) if uf.is_same(a-1, b-1): continue if uf.count(a-1)>uf.count(b-1): a, b = b, a ra, rb = uf.root(a-1), uf.root(b-1) if uf.count(a-1)