import sys

input = sys.stdin.readline

from collections import deque



nn = 200200

mod = 10**9+7



fa = [1] * (nn+1)

fainv = [1] * (nn+1)

inv = [1] * (nn+1)

for i in range(nn):

    fa[i+1] = fa[i] * (i+1) % mod

fainv[-1] = pow(fa[-1], mod-2, mod)

for i in range(nn)[::-1]:

    fainv[i] = fainv[i+1] * (i+1) % mod

for i in range(1, nn)[::-1]:

    inv[i] = fainv[i] * fa[i-1]



C = lambda a, b: fa[a] * fainv[b] % mod * fainv[a-b] % mod if 0 <= b <= a else 0



N = int(eval(input()))

X = [[] for i in range(N)]

for i in range(N-1):

    x, y = list(map(int, input().split()))

    X[x-1].append(y-1)

    X[y-1].append(x-1)



P = [-1] * N

Q = deque([0])

R = []

while Q:

    i = deque.popleft(Q)

    R.append(i)

    for a in X[i]:

        if a != P[i]:

            P[a] = i

            X[a].remove(i)

            deque.append(Q, a)



BU = [1] * N

TD = [1] * N

SI = [1] * N

for i in R[::-1]:

    a = 1

    s = 1

    for j in X[i]:

        a = a * BU[j] % mod

        s += SI[j]

    SI[i] = s

    BU[i] = inv[s] * a % mod



for i in R:

    c = len(X[i])

    AL = [1] * (c + 1)

    AR = [1] * (c + 1)

    for k, j in enumerate(X[i]):

        AL[k+1] = AL[k] * BU[j] % mod

    for k, j in list(enumerate(X[i]))[::-1]:

        AR[k] = AR[k+1] * BU[j] % mod

    for k, j in enumerate(X[i]):

        TD[j] = TD[i] * AL[k] % mod * AR[k+1] % mod * inv[N - SI[j]] % mod



for i in range(N):

    print((BU[i] * fa[SI[i]] % mod * TD[i] % mod * fa[N - SI[i]] % mod * C(N-1, SI[i] - 1) % mod))
import sys

input = sys.stdin.readline

from collections import deque



nn = 200200

mod = 10**9+7



fa = [1] * (nn+1)

fainv = [1] * (nn+1)

inv = [1] * (nn+1)

for i in range(nn):

    fa[i+1] = fa[i] * (i+1) % mod

fainv[-1] = pow(fa[-1], mod-2, mod)

for i in range(nn)[::-1]:

    fainv[i] = fainv[i+1] * (i+1) % mod

for i in range(1, nn)[::-1]:

    inv[i] = fainv[i] * fa[i-1]



C = lambda a, b: fa[a] * fainv[b] % mod * fainv[a-b] % mod if 0 <= b <= a else 0



N = int(eval(input()))

X = [[] for i in range(N)]

for i in range(N-1):

    x, y = list(map(int, input().split()))

    X[x-1].append(y-1)

    X[y-1].append(x-1)



P = [-1] * N

Q = deque([0])

R = []

while Q:

    i = deque.popleft(Q)

    R.append(i)

    for a in X[i]:

        if a != P[i]:

            P[a] = i

            X[a].remove(i)

            deque.append(Q, a)



BU = [1] * N

TD = [1] * N

SI = [1] * N

for i in R[::-1]:

    a = 1

    s = 1

    for j in X[i]:

        a = a * BU[j] % mod

        s += SI[j]

    SI[i] = s

    BU[i] = inv[s] * a % mod



for i in R:

    c = len(X[i])

    AL = [1] * (c + 1)

    AR = [1] * (c + 1)

    for k, j in enumerate(X[i]):

        AL[k+1] = AL[k] * BU[j] % mod

    for k in range(c-1, -1, -1):

        j = X[i][k]

        AR[k] = AR[k+1] * BU[j] % mod

    for k, j in enumerate(X[i]):

        TD[j] = TD[i] * AL[k] % mod * AR[k+1] % mod * inv[N - SI[j]] % mod



for i in range(N):

    print((BU[i] * fa[SI[i]] % mod * TD[i] % mod * fa[N - SI[i]] % mod * C(N-1, SI[i] - 1) % mod))
import sys

input = sys.stdin.readline
from collections import deque

nn = 200200
mod = 10**9 + 7
fa = [1] * (nn + 1)
fainv = [1] * (nn + 1)
inv = [1] * (nn + 1)
for i in range(nn):
    fa[i + 1] = fa[i] * (i + 1) % mod
fainv[-1] = pow(fa[-1], mod - 2, mod)
for i in range(nn)[::-1]:
    fainv[i] = fainv[i + 1] * (i + 1) % mod
for i in range(1, nn)[::-1]:
    inv[i] = fainv[i] * fa[i - 1]
C = lambda a, b: fa[a] * fainv[b] % mod * fainv[a - b] % mod if 0 <= b <= a else 0
N = int(eval(input()))
X = [[] for i in range(N)]
for i in range(N - 1):
    x, y = list(map(int, input().split()))
    X[x - 1].append(y - 1)
    X[y - 1].append(x - 1)
P = [-1] * N
Q = deque([0])
R = []
while Q:
    i = deque.popleft(Q)
    R.append(i)
    for a in X[i]:
        if a != P[i]:
            P[a] = i
            X[a].remove(i)
            deque.append(Q, a)
BU = [1] * N
TD = [1] * N
SI = [1] * N
for i in R[::-1]:
    a = 1
    s = 1
    for j in X[i]:
        a = a * BU[j] % mod
        s += SI[j]
    SI[i] = s
    BU[i] = inv[s] * a % mod
for i in R:
    c = len(X[i])
    AL = [1] * (c + 1)
    AR = [1] * (c + 1)
    for k, j in enumerate(X[i]):
        AL[k + 1] = AL[k] * BU[j] % mod
    for k, j in list(enumerate(X[i]))[::-1]:
        AR[k] = AR[k + 1] * BU[j] % mod
    for k, j in enumerate(X[i]):
        TD[j] = TD[i] * AL[k] % mod * AR[k + 1] % mod * inv[N - SI[j]] % mod
for i in range(N):
    print(
        (
            BU[i]
            * fa[SI[i]]
            % mod
            * TD[i]
            % mod
            * fa[N - SI[i]]
            % mod
            * C(N - 1, SI[i] - 1)
            % mod
        )
    )

import sys

input = sys.stdin.readline
from collections import deque

nn = 200200
mod = 10**9 + 7
fa = [1] * (nn + 1)
fainv = [1] * (nn + 1)
inv = [1] * (nn + 1)
for i in range(nn):
    fa[i + 1] = fa[i] * (i + 1) % mod
fainv[-1] = pow(fa[-1], mod - 2, mod)
for i in range(nn)[::-1]:
    fainv[i] = fainv[i + 1] * (i + 1) % mod
for i in range(1, nn)[::-1]:
    inv[i] = fainv[i] * fa[i - 1]
C = lambda a, b: fa[a] * fainv[b] % mod * fainv[a - b] % mod if 0 <= b <= a else 0
N = int(eval(input()))
X = [[] for i in range(N)]
for i in range(N - 1):
    x, y = list(map(int, input().split()))
    X[x - 1].append(y - 1)
    X[y - 1].append(x - 1)
P = [-1] * N
Q = deque([0])
R = []
while Q:
    i = deque.popleft(Q)
    R.append(i)
    for a in X[i]:
        if a != P[i]:
            P[a] = i
            X[a].remove(i)
            deque.append(Q, a)
BU = [1] * N
TD = [1] * N
SI = [1] * N
for i in R[::-1]:
    a = 1
    s = 1
    for j in X[i]:
        a = a * BU[j] % mod
        s += SI[j]
    SI[i] = s
    BU[i] = inv[s] * a % mod
for i in R:
    c = len(X[i])
    AL = [1] * (c + 1)
    AR = [1] * (c + 1)
    for k, j in enumerate(X[i]):
        AL[k + 1] = AL[k] * BU[j] % mod
    for k in range(c - 1, -1, -1):
        j = X[i][k]
        AR[k] = AR[k + 1] * BU[j] % mod
    for k, j in enumerate(X[i]):
        TD[j] = TD[i] * AL[k] % mod * AR[k + 1] % mod * inv[N - SI[j]] % mod
for i in range(N):
    print(
        (
            BU[i]
            * fa[SI[i]]
            % mod
            * TD[i]
            % mod
            * fa[N - SI[i]]
            % mod
            * C(N - 1, SI[i] - 1)
            % mod
        )
    )

-    for k, j in list(enumerate(X[i]))[::-1]: +    for k in range(c - 1, -1, -1): +        j = X[i][k]