# Original solution
import math
import sys
from collections import deque
to = [0]
treenum = [0]
dpv = [0]
N = 0
NMAX = 2*(10**5)
MOD = 10**9+7

fact = [0 for i in range(NMAX+1)]
fact[0] = 1
invfact = [0 for i in range(NMAX+1)]
invfact[0] = 1


def pways(v, parent):
    global to, dpv, treenum, fact, invfact, MOD

    if dpv[parent][v] != 0:
        return dpv[parent][v], treenum[parent][v]

    ans = 1
    num = 1
    for i in to[v]:
        if i != parent and i != v:
            c_ans, c_num = pways(i, v)
            num += c_num
            ans = (ans*c_ans) *invfact[c_num] % (MOD)
    
    treenum[parent][v] = num
    treenum[v][v] = N
    dpv[parent][v] = ans * fact[num-1] % (MOD)

    return dpv[parent][v], treenum[parent][v]

def revways(v, parent):
    global dpv, treenum, N, fact, invfact, MOD

    if dpv[parent][parent] == 0:
        treenum[parent][v] = N-treenum[v][parent]
        #dpv[parent][v] = (dpv[v][v]*invfact[treenum[v][v]-1]*fact[treenum[v][v]-1-treenum[v][parent]]*fact[treenum[v][parent]]% (MOD)/dpv[v][parent]) % (MOD)
        val = (dpv[v][v]*invfact[treenum[v][v]-1]*fact[treenum[v][v]-1-treenum[v][parent]]*fact[treenum[v][parent]]% (MOD)) % (MOD)
        dpv[parent][parent] =  val *invfact[treenum[parent][v]] *invfact[treenum[v][parent]-1] * fact[N-1] % (MOD)


def main():
    global to, N, dpv, treenum, fact, invfact, NMAX, MOD
    input = sys.stdin.readline
    N = int(eval(input()))

    to = [[] for i in range(N+1)]
    dpv = [[0 for i in range(N+1)] for j in range(N+1)]
    treenum = [[0 for i in range(N+1)] for j in range(N+1)]

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


    for i in range(NMAX):
        fact[i+1] = fact[i]*(i+1)%(MOD)

    invfact[NMAX] = pow(fact[NMAX], MOD-2, MOD)
    for i in range(NMAX-1,0,-1):
        invfact[i] = invfact[i+1] * (i+1) % MOD

    pways(1,1)

    bfs = deque([])
    for i in range(1, N+1):
        if i in to[1]:
            bfs.append([1,i])

    while len(bfs) != 0:
        i = bfs.popleft()
        revways(i[0], i[1])
        for j in range(1, N+1):
            if j != i[0] and j in to[i[1]]:
                bfs.append([i[1],j])

    for i in range(1,N+1):
        print((int(dpv[i][i])))

main()

# Optimized solution
import math
import sys
from collections import deque

sys.setrecursionlimit(10 ** 9)

to = {0:[0]}
treenum = {(0,0):0}
dpv = {(0,0):0}
N = 0
NMAX = 2*(10**5)
MOD = 10**9+7

fact = [0 for i in range(NMAX+1)]
fact[0] = 1
invfact = [0 for i in range(NMAX+1)]
invfact[0] = 1


def pways(v, parent):
    global to, dpv, treenum, fact, invfact, MOD

    ans = 1
    num = 1
    for i in to[v]:
        if i != parent and i != v:
            c_ans, c_num = pways(i, v)
            num += c_num
            ans = (ans*c_ans) *invfact[c_num] % (MOD)
    
    treenum[(parent,v)] = num
    treenum[(v,v)] = N
    dpv[(parent,v)] = ans * fact[num-1] % (MOD)

    return dpv[(parent,v)], treenum[(parent,v)]

def revways(v, parent):
    global dpv, treenum, N, fact, invfact, MOD

    # if dpv.get(parent,parent) == None:
    treenum[(parent,v)] = N-treenum[(v,parent)]
    #dpv[parent][v] = (dpv[v][v]*invfact[treenum[v][v]-1]*fact[treenum[v][v]-1-treenum[v][parent]]*fact[treenum[v][parent]]% (MOD)/dpv[v][parent]) % (MOD)
    val = (dpv[(v,v)]*invfact[treenum[(v,v)]-1]*fact[treenum[(v,v)]-1-treenum[(v,parent)]]*fact[treenum[(v,parent)]]% (MOD)) % (MOD)
    dpv[(parent,parent)] =  val *invfact[treenum[(parent,v)]] *invfact[treenum[(v,parent)]-1] * fact[N-1] % (MOD)


def main():
    global to, N, dpv, treenum, fact, invfact, NMAX, MOD
    input = sys.stdin.readline
    N = int(eval(input()))
    to = [[] for i in range(N+1)]

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


    for i in range(NMAX):
        fact[i+1] = fact[i]*(i+1)%(MOD)

    invfact[NMAX] = pow(fact[NMAX], MOD-2, MOD)
    for i in range(NMAX-1,0,-1):
        invfact[i] = invfact[i+1] * (i+1) % MOD

    pways(1,1)

    bfs = deque([])
    for i in range(1, N+1):
        if i in to[1]:
            bfs.append([1,i])

    while len(bfs) != 0:
        i = bfs.popleft()
        revways(i[0], i[1])
        for j in range(1, N+1):
            if j != i[0] and j in to[i[1]]:
                bfs.append([i[1],j])

    for i in range(1,N+1):
        print((int(dpv[(i,i)])))

main()