output_description: For each k=1, 2, ..., N in this order, print a line containing the answer to
  the problem.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      a_1 b_1
      :
      a_{N-1} b_{N-1}
attempt: import sys
  
  
  # 2乗の木DP
  
  
  def prepare(n, MOD):
      f = 1
      factorials = [1]  # 0!の分
      for m in range(1, n + 1):
          f *= m
          f %= MOD
          factorials.append(f)
      inv = pow(f, MOD - 2, MOD)
      invs = [1] * (n + 1)
      invs[n] = inv
      for m in range(n, 1, -1):
          inv *= m
          inv %= MOD
          invs[m - 1] = inv
  
      return factorials, invs
  
  
  def nhr(factorials, invs, n, r, MOD):
      return factorials[n + r - 1] * invs[n - 1] * invs[r] % MOD
  
  
  def dfs0(links):
      q = [(0, -1)]
      while q:
          v, p = q.pop()
          links[v].discard(p)
          links[v] = list(links[v])
          q.extend((u, v) for u in links[v])
  
  
  def dfs1(links, st_count_fwd, st_count_bwd, st_pattern_fwd, st_pattern_bwd):
      q = [(0, -1, 0)]
      while q:
          v, p, o = q.pop()
          if o == 0:
              # 初回訪問
              q.append((v, p, 1))
              q.extend((u, v, 0) for u in links[v])
          else:
              # 子の探索が終わった後の砲門
              curr_count = [0]
              curr_pattern = [1]
              for u in links[v]:
                  stc_u = st_count_fwd[u][-1] + 1
                  new_pattern = (
                      factorials[curr_count[-1] + stc_u]
                      * invs[curr_count[-1]]
                      * invs[stc_u]
                      % MOD
                  )
                  curr_pattern.append(
                      new_pattern * curr_pattern[-1] * st_pattern_fwd[u][-1] % MOD
                  )
                  curr_count.append(curr_count[-1] + stc_u)
              st_count_fwd[v] = curr_count
              st_pattern_fwd[v] = curr_pattern
              curr_count = [0]
              curr_pattern = [1]
              for u in reversed(links[v]):
                  stc_u = st_count_fwd[u][-1] + 1
                  new_pattern = (
                      factorials[curr_count[-1] + stc_u]
                      * invs[curr_count[-1]]
                      * invs[stc_u]
                      % MOD
                  )
                  curr_pattern.append(
                      new_pattern * curr_pattern[-1] * st_pattern_fwd[u][-1] % MOD
                  )
                  curr_count.append(curr_count[-1] + stc_u)
              st_count_bwd[v] = curr_count[::-1]
              st_pattern_bwd[v] = curr_pattern[::-1]
  
  
  def dfs2(links, st_count_fwd, st_count_bwd, st_pattern_fwd, st_pattern_bwd, ans):
      def sub(v, pc, pp):
          # print(v, pc, pp)
          if pc == 0:
              ans[v] = st_pattern_fwd[v][-1]
          else:
              cc = st_count_fwd[v][-1]
              cp = st_pattern_fwd[v][-1]
              pattern = factorials[cc + pc] * invs[cc] * invs[pc] % MOD
              pattern = pattern * cp * pp % MOD
              ans[v] = pattern
  
          for i, u in enumerate(links[v]):
              fc = st_count_fwd[v][i]
              fp = st_pattern_fwd[v][i]
              bc = st_count_bwd[v][i + 1]
              bp = st_pattern_bwd[v][i + 1]
              p1 = factorials[fc + bc] * invs[fc] * invs[bc] % MOD
              p1 = p1 * fp * bp % MOD
              p2 = factorials[fc + bc + pc] * invs[fc + bc] * invs[pc] % MOD
              p2 = p2 * p1 * pp % MOD
              # print(v, u, fc, fp, bc, bp, p1, p2)
              sub(u, fc + bc + pc + 1, p2)
  
      sub(0, 0, 1)
  
  
  n, *ab = map(int, sys.stdin.buffer.read().split())
  links = [set() for _ in range(n)]
  for a, b in zip(ab[0::2], ab[1::2]):
      a -= 1
      b -= 1
      links[a].add(b)
      links[b].add(a)
  MOD = 10**9 + 7
  factorials, invs = prepare(n, MOD)
  st_count_fwd = [[] for _ in range(n)]
  st_count_bwd = [[] for _ in range(n)]
  st_pattern_fwd = [[] for _ in range(n)]
  st_pattern_bwd = [[] for _ in range(n)]
  ans = [0] * n
  
  dfs0(links)
  dfs1(links, st_count_fwd, st_count_bwd, st_pattern_fwd, st_pattern_bwd)
  # print(st_count_fwd, st_count_bwd, st_pattern_fwd, st_pattern_bwd, sep='\n')
  dfs2(links, st_count_fwd, st_count_bwd, st_pattern_fwd, st_pattern_bwd, ans)
  print("\n".join(map(str, ans)))
  
problem_description: Statement
  
  We have a tree with N vertices numbered 1 to N. The i-th edge in this tree
  connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:
  
    * Consider writing a number on each vertex in the tree in the following manner:
      * First, write 1 on Vertex k.
      * Then, for each of the numbers 2, ..., N in this order, write the number on the vertex chosen as follows:
        * Choose a vertex that still does not have a number written on it and is adjacent to a vertex with a number already written on it. If there are multiple such vertices, choose one of them at random.
    * Find the number of ways in which we can write the numbers on the vertices, modulo (10^9+7).
samples: [{"input": "3\n    1 2\n    1 3", "output": "2\n    1\n    1\n    \n\nThe graph in this input is as follows:\n\n![Figure](https://img.atcoder.jp/ghi/1c88b0eb716ba399b1c5d6565ab62337.png)\n\nFor k=1, there are two ways in which we can write the numbers on the vertices,\nas follows:\n\n  * Writing 1, 2, 3 on Vertex 1, 2, 3, respectively\n  * Writing 1, 3, 2 on Vertex 1, 2, 3, respectively\n\n* * *"}, {"input": "2\n    1 2", "output": "1\n    1\n    \n\nThe graph in this input is as follows:\n\n![Figure](https://img.atcoder.jp/ghi/c47c7798f88e7bfec30fbd664dc9ad50.png)\n\n* * *"}, {"input": "5\n    1 2\n    2 3\n    3 4\n    3 5", "output": "2\n    8\n    12\n    3\n    3\n    \n\nThe graph in this input is as follows:\n\n![Figure](https://img.atcoder.jp/ghi/e9c09403f8d96ae4e679a226993defa6.png)\n\n* * *"}, {"input": "8\n    1 2\n    2 3\n    3 4\n    3 5\n    3 6\n    6 7\n    6 8", "output": "40\n    280\n    840\n    120\n    120\n    504\n    72\n    72\n    \n\nThe graph in this input is as follows:\n\n![Figure](https://img.atcoder.jp/ghi/a85459a03d436560bfe2e911d8cec4e6.png)"}]