def main():
    import sys
    sys.setrecursionlimit(300000)
    n = int(input())
    ab = [list(map(int, input().split())) for _ in [0]*(n-1)]
    g = [[] for _ in [0]*n]
    [g[a-1].append(b-1) for a, b in ab]
    [g[b-1].append(a-1) for a, b in ab]
    mod = 10**9+7
    fact = [1, 1]
    for i in range(2, 10**5):
        fact.append(fact[-1]*i % mod)

    def nCr(n, r, mod=10**9+7):
        return pow(fact[n-r]*fact[r], mod-2, mod)*fact[n] % mod

    class DP():
        def __init__(self, dp=1, t=0):
            self.dp = dp
            self.t = t

        def __add__(self, other):
            return DP(self.dp*other.dp*nCr(self.t+other.t, self.t), self.t+other.t)

        def addRoot(self):
            return DP(self.dp, self.t+1)

    dp = [[] for _ in [0]*n]
    ans = [0]*n

    def dfs(v, p=-1):
        dpSum = DP()
        dp[v] = [DP() for _ in [0]*len(g[v])]
        for i in range(len(g[v])):
            u = g[v][i]
            if u == p:
                continue
            dp[v][i] = dfs(u, v)
            dpSum = dpSum+dp[v][i]
        return dpSum.addRoot()

    def bfs(v, dpP=DP(), p=-1):
        deg = len(g[v])
        for i in range(deg):
            if g[v][i] == p:
                dp[v][i] = dpP
        dpLeft = [DP() for _ in range(deg+1)]
        dpRight = [DP() for _ in range(deg+1)]
        for i in range(deg):
            dpLeft[i+1] = dpLeft[i]+dp[v][i]
        for i in range(deg-1, -1, -1):
            dpRight[i] = dpRight[i+1]+dp[v][i]
        ans[v] = dpLeft[deg].addRoot()
        for i in range(deg):
            u = g[v][i]
            if u == p:
                continue
            d = dpLeft[i]+dpRight[i+1]
            bfs(u, d.addRoot(), v)

    dfs(0)
    bfs(0)
    for i in range(n):
        print(ans[i].dp)


main()


### FIXED CODE ###

def main():
    mod = 10**9+7
    fact = [1, 1]
    for i in range(2, 200000):
        fact.append(fact[-1]*i % mod)
    n = int(input())
    ab = [list(map(int, input().split())) for _ in [0]*(n-1)]
    g = [[] for _ in [0]*n]
    [g[a-1].append(b-1) for a, b in ab]
    [g[b-1].append(a-1) for a, b in ab]
    g2 = [set(i) for i in g]
    child = [1]*n  # 子の数
    q = [-1, 0]
    while len(q) > 1:  # DFS
        i = q[-1]
        if g2[i]:
            j = g2[i].pop()
            g2[j].remove(i)
            q.append(j)
        else:
            q.pop()
            if len(q) > 1:
                child[q[-1]] += child[i]
    rank = [(j, i) for i, j in enumerate(child)]
    rank = [j for i, j in sorted(rank)]
    dp = [1]*n
    for i in rank:
        c = child[i]
        ans = fact[c-1]
        temp = 1
        for j in g[i]:
            if child[j] < c:
                ans = ans*dp[j] % mod
                temp = temp*fact[child[j]] % mod
        dp[i] = ans*pow(temp, mod-2, mod) % mod
    dp2 = [0]*n
    dp2[0] = dp[0]
    g2 = [set(i) for i in g]
    q = [-1, 0]
    while len(q) > 1:  # DFS
        i = q[-1]
        if g2[i]:
            j = g2[i].pop()
            c = child[j]
            temp = fact[n-c]*fact[c-1]
            dp2[j] = dp2[i]*(fact[c]*fact[n-c-1])*pow(temp, mod-2, mod) % mod
            g2[j].remove(i)
            q.append(j)
        else:
            q.pop()
            if len(q) > 1:
                child[q[-1]] += child[i]

    for i in dp2:
        print(i)


main()