### BUGGY CODE ###

import sys
input = sys.stdin.readline

N=int(input())
E=[[] for i in range(N+1)]

for i in range(N-1):
    a,b=map(int,input().split())
    E[a].append(b)
    E[b].append(a)

mod=10**9+7

FACT=[1]
for i in range(1,2*10**5+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(2*10**5,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

def Combi(a,b):
    if 0<=b<=a:
        return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod
    else:
        return 0

Q=[1]
SORTED=[1]
USE=[0]*(N+1)
USE[1]=1
P=[-1]*(N+1)

while Q:
    x=Q.pop()

    for to in E[x]:
        if USE[to]==0:
            USE[to]=1
            SORTED.append(to)
            Q.append(to)
            P[to]=x

FROM1=[-1]*(N+1)
FROM2=[-1]*(N+1)

for x in SORTED[::-1]:
    if len(E[x])==1 and x!=1:
        FROM1[x]=1
        FROM2[x]=1
    else:
        L=[]
        SUML=0
        A=1
        for to in E[x]:
            if to==P[x]:
                continue
            L.append(FROM1[to])
            SUML+=FROM1[to]
            A=A*FROM2[to]%mod
        #print(x,L)
        FROM1[x]=SUML+1
        S=SUML

        for l in L:
            A=A*Combi(S,l)%mod
            S-=l
        FROM2[x]=A

TO1=[-1]*(N+1)
TO2=[-1]*(N+1)
TO2[1]=1

for x in SORTED:
    if x!=1 and len(E[x])==1:
        continue
    
    SS=1
    L=[]
    SUML=0
    for to in E[x]:
        if to==P[x]:
            continue
        
        SS=SS*FROM2[to]%mod
        L.append(FROM1[to])
        SUML+=FROM1[to]

    L.append(N-1-SUML)
    SUML+=N-1-SUML

    for to in E[x]:
        if to==P[x]:
            continue
        
        A=SS*pow(FROM2[to],mod-2,mod)*TO2[x]%mod
        S=SUML-FROM1[to]
        flag=0

        #print(x,L)
        for l in L:
            if flag==0 and l==FROM1[to]:
                flag=1
                continue
            A=A*Combi(S,l)%mod
            S-=l
        TO2[to]=A

for i in range(1,N+1):
    ANS=TO2[i]

    L=[]
    SUML=0

    for to in E[i]:
        if to==P[i]:
            continue
        ANS=ANS*FROM2[to]%mod
        L.append(FROM1[to])
        SUML+=FROM1[to]

    L.append(N-1-sum(L))
    SUML+=N-1-SUML
    S=SUML
    for l in L:
        ANS=ANS*Combi(S,l)%mod
        S-=l
    print(ANS)
        
        
        
    
        
    
        
        
        


### FIXED CODE ###

import sys
input = sys.stdin.readline

N=int(input())
E=[[] for i in range(N+1)]

for i in range(N-1):
    a,b=map(int,input().split())
    E[a].append(b)
    E[b].append(a)

mod=10**9+7

FACT=[1]
for i in range(1,2*10**5+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(2*10**5,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

def Combi(a,b):
    if 0<=b<=a:
        return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod
    else:
        return 0

Q=[1]
SORTED=[1]
USE=[0]*(N+1)
USE[1]=1
P=[-1]*(N+1)

while Q:
    x=Q.pop()

    for to in E[x]:
        if USE[to]==0:
            USE[to]=1
            SORTED.append(to)
            Q.append(to)
            P[to]=x

FROM1=[-1]*(N+1)
FROM2=[-1]*(N+1)

for x in SORTED[::-1]:
    if len(E[x])==1 and x!=1:
        FROM1[x]=1
        FROM2[x]=1
    else:
        L=[]
        SUML=0
        A=1
        for to in E[x]:
            if to==P[x]:
                continue
            L.append(FROM1[to])
            SUML+=FROM1[to]
            A=A*FROM2[to]%mod
        #print(x,L)
        FROM1[x]=SUML+1
        S=SUML

        for l in L:
            A=A*Combi(S,l)%mod
            S-=l
        FROM2[x]=A

TO1=[-1]*(N+1)
TO2=[-1]*(N+1)
TO2[1]=1

for x in SORTED:
    if x!=1 and len(E[x])==1:
        continue
    
    SS=1
    L=[]
    SUML=0
    for to in E[x]:
        if to==P[x]:
            continue
        
        SS=SS*FROM2[to]%mod
        L.append(FROM1[to])
        SUML+=FROM1[to]

    L.append(N-1-SUML)
    SUML+=N-1-SUML
    A=1
    S=SUML
    for l in L:
        A=A*Combi(S,l)%mod
        S-=l

    for to in E[x]:
        if to==P[x]:
            continue
        
        B=A*SS*pow(FROM2[to],mod-2,mod)*TO2[x]%mod

        TO2[to]=B*pow(Combi(SUML,FROM1[to]),mod-2,mod)%mod

for i in range(1,N+1):
    ANS=TO2[i]

    L=[]
    SUML=0

    for to in E[i]:
        if to==P[i]:
            continue
        ANS=ANS*FROM2[to]%mod
        L.append(FROM1[to])
        SUML+=FROM1[to]

    L.append(N-1-SUML)
    SUML+=N-1-SUML
    S=SUML
    for l in L:
        ANS=ANS*Combi(S,l)%mod
        S-=l
    print(ANS%mod)