import sys
input = sys.stdin.readline

#######################################
mod = 10**9+7
MAX_N = 200000

fact = [1]
fact_inv = [0]*(MAX_N+4)
for i in range(MAX_N+3):
    fact.append(fact[-1]*(i+1)%mod)

fact_inv[-1] = pow(fact[-1],mod-2,mod)
for i in range(MAX_N+2,-1,-1):
    fact_inv[i] = fact_inv[i+1]*(i+1)%mod


def mod_comb_k(n,k,mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n-k] %mod
#######################################

#input
n = int(input())
edge = [[] for i in range(n)]
for _ in range(n-1):
    a,b = map(int,input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

#DFS
order = []
par = [-1]*n
tank = [0]
while tank:
    pele = tank.pop()
    order.append(pele)
    for e in edge[pele]:
        if e == par[pele]:
            continue
        tank.append(e)
        par[e] = pele

size = [1]*n
for e in order[::-1]:
    if e == 0:
        break
    size[par[e]] += size[e]


dp = [1]*n
for e in order[::-1]:
    dp[e] = dp[e] * fact[size[e]-1] % mod
    if e == 0:
        break
    dp[par[e]] = (dp[par[e]] * dp[e] % mod) * fact_inv[size[e]] % mod


dp2 = [0]*n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
dp2[0] = dp[0]
for e in order[1::]:
    p = par[e]
    tmp = (dp2[p] * fact[n-1-size[e]] % mod) * fact[size[e]] % mod
    red = ( tmp * fact_inv[n-1] % mod ) * pow(dp[e],mod-2,mod) % mod
    
    size_red = n - size[e]
    tmp = (dp[e] * red % mod ) * fact[n-1] % mod
    dp2[e] = (tmp * fact_inv[size[e]-1] % mod) * fact_inv[size_red] % mod

print(*dp2,sep='\n')

Measured memory_bytes: 110028