# Original solution
import sys
from functools import lru_cache
sys.setrecursionlimit(1000000000)


def input(): return sys.stdin.readline().rstrip()


MOD = 10 ** 9 + 7


def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y

def inverse(x):
    _, _, ans = egcd(MOD, x)
    return (ans % MOD + MOD) % MOD


def memoize_fast(size):
    def decorator(f):
        memo = [-1] * size

        def wrapper(i):
            if memo[i] != -1:
                return memo[i]
            val = f(i)
            memo[i] = val
            return val

        return wrapper
    return decorator


@memoize_fast(3 * 10 ** 5)
def factorial(x):
    if x <= 1:
        return 1
    return x * factorial(x - 1) % MOD


def combination(a, b):
    return factorial(a) * inverse(factorial(b)) % MOD * inverse(factorial(a - b)) % MOD


N = int(eval(input()))
graph = [[] for _ in range(N)]
for _ in range(N - 1):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)

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

visited = set()


def visit(node):
    visited.add(node)
    for n in graph[node]:
        if n not in visited:
            children[node].append(n)
            parent[n] = node
            visit(n)


visit(0)


@memoize_fast(3 * 10 ** 5)
def count(node):
    c = 1
    for child in children[node]:
        c += count(child)
    return c


@memoize_fast(3 * 10 ** 5)
def order(node):
    ans = 1
    counts = []
    for child in children[node]:
        ans *= order(child)
        ans %= MOD
        counts.append(count(child))
    _sum = sum(counts)
    while len(counts) > 0:
        ans *= combination(_sum, counts[-1])
        ans %= MOD
        _sum -= counts.pop()
    return ans


@memoize_fast(3 * 10 ** 5)
def order_all(node):
    if parent[node] == -1:
        return order(node)
    return order_all(parent[node]) * inverse(order(node)) % MOD * inverse(combination(N - 1, count(node))) % MOD * order(node) % MOD * combination(N - 1, count(node) - 1) % MOD


for node in range(N):
    print((order_all(node)))


# Optimized solution
import sys
from functools import lru_cache
sys.setrecursionlimit(1000000000)


def input(): return sys.stdin.readline().rstrip()


MOD = 10 ** 9 + 7


def memoize_fast(size):
    def decorator(f):
        memo = [-1] * size

        def wrapper(i):
            if memo[i] != -1:
                return memo[i]
            val = f(i)
            memo[i] = val
            return val

        return wrapper
    return decorator


@memoize_fast(3 * 10 ** 5)
def factorial(x):
    if x <= 1:
        return 1
    return x * factorial(x - 1) % MOD


@lru_cache(maxsize=None)
def inverse(x):
    return pow(x, MOD - 2, MOD)


def combination(a, b):
    return factorial(a) * inverse(factorial(b)) % MOD * inverse(factorial(a - b)) % MOD


N = int(eval(input()))
graph = [[] for _ in range(N)]
for _ in range(N - 1):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)

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

visited = set()


def visit(node):
    visited.add(node)
    for n in graph[node]:
        if n not in visited:
            children[node].append(n)
            parent[n] = node
            visit(n)


visit(0)


@memoize_fast(3 * 10 ** 5)
def count(node):
    c = 1
    for child in children[node]:
        c += count(child)
    return c


@memoize_fast(3 * 10 ** 5)
def order(node):
    ans = 1
    counts = []
    for child in children[node]:
        ans *= order(child)
        ans %= MOD
        counts.append(count(child))
    _sum = sum(counts)
    while len(counts) > 0:
        ans *= combination(_sum, counts[-1])
        ans %= MOD
        _sum -= counts.pop()
    return ans


@memoize_fast(3 * 10 ** 5)
def order_all(node):
    if parent[node] == -1:
        return order(node)
    return order_all(parent[node]) * inverse(order(node)) % MOD * inverse(combination(N - 1, count(node))) % MOD * order(node) % MOD * combination(N - 1, count(node) - 1) % MOD


for node in range(N):
    print((order_all(node)))