# Original solution
class Factorial():
    def __init__(self, n, mod):
        self.mod = mod
        self.factorial = [0 for _ in range(n + 1)]
        self.inv = [0 for _ in range(n + 1)]
        self.factorial[0] = 1
        self.inv[0] = 1
        for i in range(n):
            self.factorial[i + 1] = self.factorial[i] * (i + 1) % mod
        self.inv[n] = pow(self.factorial[n], mod - 2, mod)
        for i in range(n)[::-1]:
            self.inv[i] = self.inv[i + 1] * (i + 1) % mod

    def fact(self, m):
        return self.factorial[m]

    def invfact(self, m):
        return self.inv[m]

import sys
input = sys.stdin.readline

MOD = 1000000007

N = int(eval(input()))
E = [tuple(map(int, input().split())) for _ in range(N - 1)]

tree = [[] for _ in range(N)]

for e in E:
    tree[e[0] - 1].append(e[1] - 1)
    tree[e[1] - 1].append(e[0] - 1)

visited = [0 for _ in range(N)]
visited[0] = 1

parent = [None for _ in range(N)]
parent[0] = -1

order = []
order.append(0)

stack = [0]

while stack:
    node = stack.pop()
    for adj in tree[node]:
        if not visited[adj]:
            visited[adj] = 1
            parent[adj] = node
            order.append(adj)
            stack.append(adj)

dp = [[1, 1] for _ in range(N)]
cum_l = [[1, 0] for _ in range(N)]
cum_r = [[1, 0] for _ in range(N)]

F = Factorial(N + 1, MOD)

for node in order[::-1]:
    dp_node = [1, 1]
    for adj in tree[node]:
        if parent[adj] == node:
            cum_l[adj][0] = dp_node[0]
            cum_l[adj][1] = dp_node[1]
            dp_node[1] += dp[adj][1]
            dp_node[0] *= dp[adj][0]
            dp_node[0] *= F.invfact(dp[adj][1])
            dp_node[0] *= F.fact(dp_node[1] - 1)
            dp_node[0] *= F.invfact(dp_node[1] - dp[adj][1] - 1)
            dp_node[0] %= MOD

    dp_node = [1, 1]
    for adj in tree[node][::-1]:
        if parent[adj] == node:
            cum_r[adj][0] = dp_node[0]
            cum_r[adj][1] = dp_node[1]
            dp_node[1] += dp[adj][1]
            dp_node[0] *= dp[adj][0]
            dp_node[0] *= F.invfact(dp[adj][1])
            dp_node[0] *= F.fact(dp_node[1] - 1)
            dp_node[0] *= F.invfact(dp_node[1] - dp[adj][1] - 1)
            dp_node[0] %= MOD

    dp[node][0] = dp_node[0]
    dp[node][1] = dp_node[1]

dp_inv = [[1, 0] for _ in range(N)]

for node in order:
    if node == 0:
        continue

    merged = [1, 0]
    merged[1] = cum_l[node][1] + cum_r[node][1] - 1
    merged[0] *= cum_l[node][0] * F.invfact(cum_l[node][1] - 1)
    merged[0] *= cum_r[node][0] * F.invfact(cum_r[node][1] - 1)
    merged[0] *= F.fact(merged[1] - 1)
    merged[0] %= MOD

    par = parent[node]
    dp_inv[node][0] = merged[0]
    dp_inv[node][1] = merged[1]
    dp_inv[node][1] += dp_inv[par][1]
    dp_inv[node][0] *= dp_inv[par][0]
    dp_inv[node][0] *= F.invfact(dp_inv[par][1])
    dp_inv[node][0] *= F.fact(dp_inv[node][1] - 1)
    dp_inv[node][0] *= F.invfact(dp_inv[node][1] - dp_inv[par][1] - 1)
    dp_inv[node][0] %= MOD

    dp_node = [1, 1]
    dp_node[0] = dp[node][0]
    dp_node[1] = dp[node][1]
    dp_node[1] += dp_inv[node][1]
    dp_node[0] *= dp_inv[node][0]
    dp_node[0] *= F.invfact(dp_inv[node][1])
    dp_node[0] *= F.fact(dp_node[1] - 1)
    dp_node[0] *= F.invfact(dp_node[1] - dp_inv[node][1] - 1)
    dp_node[0] %= MOD

    dp[node][0] = dp_node[0]
    dp[node][1] = dp_node[1]

res = []

for i in range(N):
    res.append(dp[i][0])

print(('\n'.join(map(str, res))))

# Optimized solution
class Tree():
    def __init__(self, n, edge):
        self.n = n
        self.tree = [[] for _ in range(n)]
        for e in edge:
            self.tree[e[0] - 1].append(e[1] - 1)
            self.tree[e[1] - 1].append(e[0] - 1)

    def setroot(self, root):
        self.root = root
        self.parent = [None for _ in range(self.n)]
        self.parent[root] = -1
        self.depth = [None for _ in range(self.n)]
        self.depth[root] = 0
        self.order = []
        self.order.append(root)
        stack = [root]
        while stack:
            node = stack.pop()
            for adj in self.tree[node]:
                if self.parent[adj] is None:
                    self.parent[adj] = node
                    self.depth[adj] = self.depth[node] + 1
                    self.order.append(adj)
                    stack.append(adj)

    def rerooting(self, func, merge, ti, ei):
        dp = [ti for _ in range(self.n)]
        lt = [ei for _ in range(self.n)]
        rt = [ei for _ in range(self.n)]
        inv = [ei for _ in range(self.n)]
        self.setroot(0)
        for node in self.order[::-1]:
            tmp = ti
            for adj in self.tree[node]:
                if self.parent[adj] == node:
                    lt[adj] = tmp
                    tmp = func(tmp, dp[adj])
            tmp = ti
            for adj in self.tree[node][::-1]:
                if self.parent[adj] == node:
                    rt[adj] = tmp
                    tmp = func(tmp, dp[adj])
            dp[node] = tmp
        for node in self.order:
            if node == 0:
                continue
            merged = merge(lt[node], rt[node])
            par = self.parent[node]
            inv[node] = func(merged, inv[par])
            dp[node] = func(dp[node], inv[node])
        return dp

class Factorial():
    def __init__(self, n, mod):
        self.mod = mod
        self.factorial = [0 for _ in range(n + 1)]
        self.inv = [0 for _ in range(n + 1)]
        self.factorial[0] = 1
        self.inv[0] = 1
        for i in range(n):
            self.factorial[i + 1] = self.factorial[i] * (i + 1) % mod
        self.inv[n] = pow(self.factorial[n], mod - 2, mod)
        for i in range(n)[::-1]:
            self.inv[i] = self.inv[i + 1] * (i + 1) % mod

    def fact(self, m):
        return self.factorial[m]

    def invfact(self, m):
        return self.inv[m]

import sys
input = sys.stdin.readline

MOD = 1000000007

N = int(eval(input()))
E = [tuple(map(int, input().split())) for _ in range(N - 1)]

T = Tree(N, E)
F = Factorial(N + 1, MOD)

def func(node, adj):
    size = node[1] + adj[1]
    count = node[0] * adj[0] * F.invfact(adj[1]) * F.fact(size - 1) * F.invfact(node[1] - 1)
    count %= MOD
    return count, size

def merge(lt, rt):
    size = lt[1] + rt[1] - 1
    count = lt[0] * rt[0] * F.invfact(lt[1] - 1) * F.invfact(rt[1] - 1) * F.fact(size - 1)
    count %= MOD
    return count, size

ti = (1, 1)
ei = (1, 0)

D = T.rerooting(func, merge, ti, ei)

res = []

for i in range(N):
    res.append(D[i][0])

print(('\n'.join(map(str, res))))