def main():
    #import random

    # def sample_tree(n):  # n頂点の連結グラフを出力する
    #    l = [random.randrange(0, i+1) for i in range(n-1)]  # 親を指定する
    #    d = {i: j for i, j in enumerate(random.sample(range(n), n))}  # シャッフル
    #    xy = sorted([sorted([d[j]+1, d[i+1]+1])
    #                 for i, j in enumerate(l)])  # グラフを作成
    #    return xy
    #n = 200000
    # print(n)
    #ab = sample_tree(n)

    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, 2*10**5+1):
        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) % mod, self.t+other.t)

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

    dp = [[DP() for _ in [0]*len(g[v])] for v in range(n)]
    dpSum = [DP() for _ in [0]*n]
    ans = [0]*n

    def dfs():
        visited = [0]*n
        q = [-1, 0]
        while len(q) > 1:
            v = q[-1]
            p = q[-2]
            flag = False
            while visited[v] < len(g[v]):
                i = visited[v]
                u = g[v][i]
                visited[v] += 1
                if u == p:
                    continue
                if visited[u]:
                    continue
                q.append(u)
                flag = True
                break
            if flag is False:
                i = visited[p]-1
                dp[p][i] = dpSum[v].addRoot()
                dpSum[p] = dpSum[p]+dp[p][i]
                q.pop()

    def bfs():
        q = [(0, DP(), -1)]
        while q:
            v, dpP, p = q.pop()
            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]
                q.append((u, d.addRoot(), v))

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


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()