#include <bits/stdc++.h>
using namespace std;

#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define ST first
#define ND second
#define MP make_pair
#define PB push_back

typedef vector<int> VI;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef set<int> SI;
typedef long long LL;

#ifdef DEBUG
const bool debug = true;
#else
const bool debug = false;
#endif

// #define MULTI_TASK true

const int inf = 1000 * 1000 * 1000;
const int MAKSN = 200 * 1000 + 13;
const LL MOD = 1e9 + 7;
int n, m, k, l, x, y, a, b;
string s;
vector<int> v;

vector<int> E[MAKSN];
int dp[MAKSN];
int ans[MAKSN];
int fact[MAKSN];
int factInv[MAKSN];
int vis[MAKSN];
int siz[MAKSN];

void zeruj() {
    v.clear();
    REP(i, MAKSN) {
        dp[i] = 1;
        vis[i] = 0;
        factInv[i] = 0;
        fact[i] = 0;
        siz[i] = 0;
    }
}

LL gcd(LL a, LL b) {
    if (!b)
        return a;
    return gcd(b, a % b);
}

LL powMod(LL a, LL b) {
    LL res = 1LL, curP = a;

    while (b > 0) {
        if (b & 1LL)
            res = (res * curP) % MOD;
        curP = (long long)(curP * curP) % MOD;
        b >>= 1;
    }

    return res;
}

LL inv(LL a) {
    return powMod(a, MOD - 2);
}

LL mul(LL a, LL b) {
    return (a * b) % MOD;
}

LL newton(LL n, LL k) {
    return mul(fact[n], mul(factInv[n - k], factInv[k]));
}

void preCalc() {
    fact[0] = 1;
    factInv[0] = 1;
    for (int i = 1; i < MAKSN; i++) {
        fact[i] = mul(fact[i - 1], i);
        factInv[i] = inv(fact[i]);
    }
}

void readIn() {
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        cin >> a >> b;
        a--;
        b--;
        E[a].PB(b);
        E[b].PB(a);
    }
}

void dfs(int u) {
    vis[u] = true;
    siz[u] = 1;
    dp[u] = 1;

    for (auto v : E[u]) {
        if (!vis[v]) {
            dfs(v);
            siz[u] += siz[v];
            dp[u] = mul(dp[u], dp[v]);
            dp[u] = mul(dp[u], factInv[siz[v]]);
        }
    }
    dp[u] = mul(dp[u], fact[siz[u] - 1]);
}

void dfs2(int u) {
    vis[u] = true;
    ans[u] = dp[u];

    for (auto v : E[u]) {
        if (!vis[v]) {
            int fsize = siz[u];
            int sonsize = siz[v];
            int dpFather = dp[u];
            int dpson = dp[v];

            // delete impact of son in father
            dp[u] = mul(dp[u], factInv[fsize - 1]);
            siz[u] -= siz[v];
            dp[u] = mul(dp[u], fact[sonsize]);
            dp[u] = mul(dp[u], fact[siz[u] - 1]);
            dp[u] = mul(dp[u], inv(dpson));

            // Add impact of father to son
            dp[v] = mul(dp[v], factInv[siz[v] - 1]);
            siz[v] += siz[u];
            dp[v] = mul(dp[v], fact[siz[v] - 1]);
            dp[v] = mul(dp[v], factInv[siz[u]]);
            dp[v] = mul(dp[v], dp[u]);

            dfs2(v);

            // revert changes
            dp[v] = dpson;
            dp[u] = dpFather;
            siz[v] = sonsize;
            siz[u] = fsize;
        }
    }
}

void solve() {
    preCalc();
    dfs(0);
    for (int i = 0; i < n; i++) vis[i] = 0;

    dfs2(0);

    for (int i = 0; i < n; i++) {
        cout << ans[i] << "\n";
    }
}

int main() {
    ios_base::sync_with_stdio(0);
#ifdef MULTI_TASK
    int test;
    cin >> test;
    while (test--) {
#endif
        zeruj();
        readIn();
        solve();
#ifdef MULTI_TASK
    }
#endif
    return 0;
}


Measured memory_bytes: 18676