# Original solution
from collections import deque
import sys
input=sys.stdin.readline

def abc():
    global qqq
    for i in range(len(ppp)-1,0,-1):
        qqq=qqq*cmb(ppp[i],ppp[i-1])%mod
    return qqq

mod=10**9+7
MAX=2*10**5+100
g1=[1,1]
g2=[1,1]
for i in range(2,MAX+1):
    num_1=g1[-1]*i%mod
    g1.append(num_1)
    g2.append(pow(num_1,mod-2,mod))
def cmb(n,r):
    return g1[n]*g2[r]*g2[n-r]%mod

N=int(eval(input()))
AB=[list(map(int,input().split())) for i in range(N-1)]

data=[[] for i in range(N+1)]
for A,B in AB:
    data[A].append(B)
    data[B].append(A)

parent=[0]*(N+1)
flag=[0]*(N+1)
child=[0]*(N+1)
parent[1]=-1
flag[1]=1
que=[1]
ddd=deque([])
while que:
    h=[]
    for u in que:
        for v in data[u]:
            if flag[v]==0:
                flag[v]=1
                h.append(v)
                parent[v]=u
                child[u]+=1
        if child[u]==0:
            ddd.append(u)
    que=h
size=[0]*(N+1)
lst=[0]*(N+1)
while ddd:
    u=ddd.pop()
    size[u]=1
    qqq=1
    ppp=[]
    for v in data[u]:
        if v==parent[u]:
            child[v]-=1
            if child[v]==0:
                ddd.appendleft(v)
            continue
        else:
            size[u]+=size[v]
            if ppp:
                ppp.append(size[v]+ppp[-1])
            else:
                ppp.append(size[v])
            qqq=qqq*lst[v]%mod
    lst[u]=abc()
que=deque(data[1][:])
ans=[0]*(N+1)
lsls=[0]*(N+1)
ans[1]=lst[1]
lsls[1]=1
while que:
    u=que.pop()
    par=parent[u]
    qqq=1
    qqq*=lsls[par]
    ppp=N-size[par]
    for v in data[par]:
        if v==u:
            continue
        if v==parent[par]:
            continue
        else:
            qqq=qqq*lst[v]*cmb(size[v]+ppp,ppp)%mod
            ppp+=size[v]
    lsls[u]=qqq
    ppp=N-size[u]
    for v in data[u]:
        if v==parent[u]:
            continue
        else:
            qqq=qqq*lst[v]*cmb(size[v]+ppp,ppp)%mod
            ppp+=size[v]
            que.appendleft(v)
    ans[u]=qqq
for i in range(1,N+1):
    print((ans[i]))

# Optimized solution
from collections import deque
import sys
input=sys.stdin.readline

def abc():
    global qqq
    for i in range(len(ppp)-1,0,-1):
        qqq=qqq*cmb(ppp[i],ppp[i-1])%mod
    return qqq

mod=10**9+7
MAX=2*10**5+100
g1=[1,1]
g2=[1,1]
for i in range(2,MAX+1):
    num_1=g1[-1]*i%mod
    g1.append(num_1)
    g2.append(pow(num_1,mod-2,mod))
def cmb(n,r):
    return g1[n]*g2[r]*g2[n-r]%mod

N=int(eval(input()))
AB=[list(map(int,input().split())) for i in range(N-1)]
data=[[] for i in range(N+1)]
for A,B in AB:
    data[A].append(B)
    data[B].append(A)
parent=[0]*(N+1)
flag=[0]*(N+1)
child=[0]*(N+1)
parent[1]=-1
flag[1]=1
que=[1]
ddd=deque([])
while que:
    h=[]
    for u in que:
        for v in data[u]:
            if flag[v]==0:
                flag[v]=1
                h.append(v)
                parent[v]=u
                child[u]+=1
        if child[u]==0:
            ddd.append(u)
    que=h
#sizeは、子の数
size=[0]*(N+1)
#lstは、書く順番の総数
lst=[0]*(N+1)
while ddd:
    u=ddd.pop()
    size[u]=1
    qqq=1
    ppp=[]
    for v in data[u]:
        if v==parent[u]:
            child[v]-=1
            if child[v]==0:
                ddd.appendleft(v)
            continue
        else:
            size[u]+=size[v]
            if ppp:
                ppp.append(size[v]+ppp[-1])
            else:
                ppp.append(size[v])
            qqq=qqq*lst[v]%mod
    lst[u]=abc()
que=deque(data[1][:])
#iを根としたときの答え
ans=[0]*(N+1)
#lslsは親方向の場合の数
lsls=[0]*(N+1)
ans[1]=lst[1]
lsls[1]=1
while que:
    #uに対する場合の数を求める
    u=que.pop()
    par=parent[u]
    ppp=N-size[par]
    num=lst[u]*cmb(size[par]-1,size[u])
    qqq=lst[par]*pow(num,mod-2,mod)%mod
    qqq=qqq*lsls[par]*cmb(ppp+size[par]-size[u]-1,ppp)%mod
    lsls[u]=qqq
    ppp=N-size[u]
    qqq=qqq*cmb(N-1,size[u]-1)*lst[u]%mod
    ans[u]=qqq
    for v in data[u]:
        if v==par:
            continue
        else:
            que.appendleft(v)
for i in range(1,N+1):
    print((ans[i]))