### BUGGY CODE ###

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys, resource
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

resource.setrlimit(resource.RLIMIT_STACK,
                   (resource.RLIM_INFINITY, resource.RLIM_INFINITY))

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)


M = Mod(10**9 + 7)

fact_ = [1] * (2 * (10**5) + 1)
for i in range(1, 2 * (10**5)+1):
    fact_[i] = M.mul(fact_[i-1], i)


def fact(n):
    return fact_[n]




@mt
def slv(N, AB):
    g = defaultdict(set)
    for a, b in AB:
        g[a].add(b)
        g[b].add(a)

    @lru_cache(maxsize=None)
    def f(u, p):
        n = 0
        r = 1
        nn = []
        for v in g[u]:
            if v == p:
                continue
            n_, r_ = f(v, u)
            r = M.mul(r, r_)
            n += n_
            nn.append(n_)

        ret = M.mul(fact(n), r)
        for i in nn:
            ret = M.div(ret, fact(i))

        return n+1, ret

    for i in range(1, N+1):
        print(f(i, 0)[1])


def main():
    N = read_int()
    AB = [read_int_n() for _ in range(N-1)]
    (slv(N, AB))

    # N = (10**5) * 2
    # AB = [(_, _+1) for _ in range(N-1)]
    # (slv(N, AB))



if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
import resource
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


sys.setrecursionlimit(10**6)
input = sys.stdin.readline
INF = 2**62-1


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return (a * b) % self.m

    def div(self, a, b):
        return self.mul(a, self.pow(b, self.m-2))

    @lru_cache(maxsize=None)
    def pow(self, a, b):
        return pow(a, b, self.m)


M = Mod(10**9 + 7)
m = 10**9 + 7
fact = [1] * (2 * (10**5) + 1)
fact_inv = [0] * (2 * (10**5) + 1)
for i in range(1, 2 * (10**5)+1):
    fact[i] = M.mul(fact[i-1], i)
    fact_inv[i] = pow(fact[i], m-2, m)


@mt
def slv(N, AB):
    g = defaultdict(list)
    for a, b in AB:
        g[a].append(b)
        g[b].append(a)

    memo = defaultdict(dict)

    def f(u, p, flag=False):
        if u in memo and p in memo[u]:
            return memo[u][p]
        r = 1
        n = 1
        if p == 0 or flag:
            for v in g[u]:
                if v == p:
                    continue
                n_, r_ = f(v, u, flag)
                n += n_
                r = M.mul(r, r_)
                r = M.mul(r, fact_inv[n_])
            r = M.mul(r, fact[n-1])
        else:
            np, rp = f(p, u, False)
            na, ra = f(u, 0, False)
            r = M.div(ra, rp)
            r = M.mul(r, fact[np])
            n = na - np
            r = M.mul(r, fact_inv[na-1])
            r = M.mul(r, fact[n-1])

        memo[u][p] = n, r
        return n, r

    f(1, 0, True)

    for i in range(1, N+1):
        print(f(i, 0, False)[1])


def main():
    N = read_int()
    AB = [read_int_n() for _ in range(N-1)]
    slv(N, AB)

    # N = (10**5) * 2
    # AB = [(_, _+1) for _ in range(N-1)]
    # (slv(N, AB))


if __name__ == '__main__':
    main()