#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll N = 2e5 + 5, mod = 1e9 + 7;
vector<ll> g[N];
ll a[N], n, sz[N], tmp = 1;

ll ksm(ll a, ll n) {
    ll ans = 1;
    while (n) {
        if (n & 1) ans = ans * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return ans;
}

void dfs(int u, int fa) {
    sz[u] = 1;
    for (auto v : g[u]) {
        if (v != fa) {
            dfs(v, u);
            sz[u] += sz[v];
        }
    }
    tmp = tmp * sz[u] % mod;
}

void fun(int u, int fa) {
    for (auto v : g[u]) {
        if (v != fa) {
            a[v] = a[u] * ksm(sz[v], mod - 2) % mod * (n - sz[v]) % mod;
            fun(v, u);
        }
    }
}

int main() {
    cin >> n;
    ll jc = 1;
    for (ll i= 2, u, v; i <= n; ++i) {
        cin >> u >> v;
        g[u].push_back(v), g[v].push_back(u);
        jc = jc * i % mod;
    }
    dfs(1, 0);
    a[1] = tmp;
    fun(1, 0);
    for (int i = 1; i <= n; ++i) {
        printf("%lld\n", jc * ksm(a[i], mod - 2) % mod);
    }
    return 0;
}