#include <bits/stdc++.h>


using namespace std;


#ifdef zxc

#include "debug.h"

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ll = int64_t;
using ld = long double;
const ld EPS = 1e-8;
const ll MOD = 1e9 + 7;
const ld PI = 3.141592653589793;
const int maxn = 200001;

void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}

vector<int> g[maxn];
int sz[maxn];
ll dp[maxn];
ll fac[maxn];
ll inv[maxn];

ll C(int n, int k) {
    if (k < 0 || k > n) {
        return 0;
    }
    return inv[k] * inv[n - k] % MOD * fac[n] % MOD;
}

void dfs(int v, int p) {
    sz[v] = 1;
    int z = -1;
    for (int to:g[v]) {
        if (to != p) {
            dfs(to, v);
            sz[v] += sz[to];
            if (z == -1) {
                z = to;
            }
        }
    }
    if (z == -1) {
        dp[v] = 1;
        return;
    }
    dp[v] = dp[z];
    int cur_sz = sz[z];
    for (int to:g[v]) {
        if (to == p || to == z)
            continue;
        (dp[v] *= dp[to]) %= MOD;
        cur_sz += sz[to];
        dp[v] *= C(cur_sz, sz[to]);
        dp[v] %= MOD;
    }
}

ll ans[maxn];
int n;
vector<ll> pref_dp[maxn];
vector<ll> suff_dp[maxn];
vector<ll> pref_sz[maxn];
vector<ll> suff_sz[maxn];

void rec(int v, int p) {
    int cur_sz = sz[g[v].front()];
    ans[v] = dp[g[v].front()];
    for (int to:g[v]) {
        if (to == g[v][0]) {
            continue;
        }
        cur_sz += sz[to];
        ans[v] *= dp[to];
        ans[v] %= MOD;
        ans[v] *= C(cur_sz, sz[to]);
        ans[v] %= MOD;
    }
    vector<int> children;
    children.push_back(-1);
    for (int to:g[v]) {
        if (to != p) {
            children.push_back(to);
        }
    }
    int ch = children.size() - 1;
    pref_sz[v].resize(ch + 1);
    suff_sz[v].resize(ch + 2);
    suff_dp[v].resize(ch + 2);
    pref_dp[v].resize(ch + 1);
    for (int i = 1; i <= ch; ++i) {
        pref_sz[v][i] = pref_sz[v][i - 1] + sz[children[i]];
    }
    for (int i = ch; i >= 1; --i) {
        suff_sz[v][i] = suff_sz[v][i + 1] + sz[children[i]];
    }
    pref_dp[v][0] = 1;
    for (int i = 1; i <= ch; ++i) {
        pref_dp[v][i] = pref_dp[v][i - 1] * dp[children[i]] % MOD;
        pref_dp[v][i] *= C(pref_sz[v][i], sz[children[i]]);
        pref_dp[v][i] %= MOD;
    }
    suff_dp[v][ch + 1] = 1;
    for (int i = ch; i >= 1; --i) {
        suff_dp[v][i] = suff_dp[v][i + 1] * dp[children[i]] % MOD;
        suff_dp[v][i] *= C(suff_sz[v][i], sz[children[i]]);
        suff_dp[v][i] %= MOD;
    }
    int was_sz = sz[v];
    ll was_dp = dp[v];
    for (int i = 1; i <= ch; ++i) {
        sz[v] = n - sz[children[i]];
        dp[v] = pref_dp[v][i - 1] * suff_dp[v][i + 1] % MOD *
                C(pref_sz[v][i - 1] + suff_sz[v][i + 1], pref_sz[v][i - 1]) % MOD;
        if (p != -1) {
            dp[v] *= dp[p];
            dp[v] %= MOD;
            dp[v] *= C(pref_sz[v][i - 1] + suff_sz[v][i + 1] + sz[p], sz[p]);
            dp[v] %= MOD;
        }
        rec(children[i],v);
    }
    sz[v] = was_sz;
    dp[v] = was_dp;
}

ll pw(ll a, ll b) {
    ll res = 1;
    for (; b; b >>= 1) {
        if (b & 1) {
            res = res * a % MOD;
        }
        a = a * a % MOD;
    }
    return res;
}

signed main() {
#ifdef zxc
    mt19937 mt(228);
    freopen("../kolya_input.txt", "r", stdin);
//    freopen("../kolya_output.txt", "w", stdout);
#else
    mt19937 mt(std::chrono::high_resolution_clock::now().time_since_epoch().count());
//            freopen("", "r", stdin);
//        freopen("hack.out", "w", stdout);
#endif
    fast_io();
    cout.precision(10);
    cout << fixed;
    auto start = chrono::steady_clock::now();
    cin >> n;
    for (int i = 1; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    fac[0] = 1;
    for (int i = 1; i <= n; ++i) {
        fac[i] = fac[i - 1] * i % MOD;
    }
    inv[n] = pw(fac[n], MOD - 2);
    for (int i = n - 1; i >= 0; --i) {
        inv[i] = inv[i + 1] * (i + 1) % MOD;
    }
    dfs(1, 1);
    rec(1, -1);
    for (int i = 1; i <= n; ++i) {
        cout << ans[i] << "\n";
    }
    auto end = chrono::steady_clock::now();
    debug("time", chrono::duration_cast<chrono::milliseconds>(end - start).count() / 1000.0);

}



Measured memory_bytes: 71012