#include <iostream>
#include <algorithm>
#include <vector>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
const int mod = (int)1e9 + 7, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };

#define N 200003

ll fac[N], inv[N], finv[N];

void cominit(int n) {
    int i;
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (i = 2; i < n + 2; i++) {
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
    return;
}

ll com(int n, int r) {
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    if (r == 0 || r == n) return 1;
    return (fac[n] * finv[r]) % mod * finv[n - r] % mod;
}

int n;
vector<int> g[N], vs[N], vs1[N], vs2[N];
vector<ll> vv1[N], vv2[N], vcom1[N], vcom2[N];

int dfs_vs(int fr, int cu) {
    int i, vsr;
    vsr = 0;
    for (i = 0; i < g[cu].size(); i++) {
        if (g[cu][i] != fr) {
            vs[cu][i] = dfs_vs(cu, g[cu][i]);
            vsr += vs[cu][i];
        }
    }
    for (i = 0; i < g[cu].size(); i++) {
        if (g[cu][i] == fr) {
            vs[cu][i] = n - 1 - vsr;
            break;
        }
    }
    for (i = 0; i < g[cu].size(); i++) {
        vs1[cu][i] = vs2[cu][i] = vs[cu][i];
    }
    for (i = 1; i < g[cu].size(); i++) {
        vs1[cu][i] += vs1[cu][i - 1];
    }
    for (i = g[cu].size() - 2; i >= 0; i--) {
        vs2[cu][i] += vs2[cu][i + 1];
    }
    for (i = 1; i < g[cu].size(); i++) {
        vcom1[cu][i] = vcom1[cu][i - 1] * com(vs1[cu][i], vs[cu][i]) % mod;
    }
    for (i = g[cu].size() - 2; i >= 0; i--) {
        vcom2[cu][i] = vcom2[cu][i + 1] * com(vs2[cu][i], vs[cu][i]) % mod;
    }
    return vsr + 1;
}

ll dfs1(int fr, int cu) {
    int i;
    ll res, l, r;
    for (i = 0; i < g[cu].size(); i++) {
        if (g[cu][i] != fr) {
            vv1[cu][i] = dfs1(cu, g[cu][i]);
        }
    }
    res = 1;
    for (i = 0; i < g[cu].size(); i++) {
        if (g[cu][i] != fr) {
            res = res * vv1[cu][i] % mod;
        }
    }
    if (fr == -1) return 0;
    i = 0;
    while (g[cu][i] != fr) {
        i++;
    }
    l = r = 1;
    if (i > 0) l = vcom1[cu][i - 1];
    if (i < g[cu].size() - 1) r = vcom2[cu][i + 1];
    res = res * l % mod * r % mod;
    if (i > 0) res = res * com(n - 1 - vs[cu][i], vs1[cu][i - 1]) % mod;
    return res;
}

void dfs2(int fr, int cu, ll va) {
    int i;
    ll l, r, nva;
    for (i = 0; i < g[cu].size(); i++) {
        if (g[cu][i] == fr) {
            vv1[cu][i] = va;
        }
    }
    for (i = 0; i < g[cu].size(); i++) {
        vv2[cu][i] = vv1[cu][i];
    }
    for (i = 1; i < g[cu].size(); i++) {
        vv1[cu][i] = vv1[cu][i] * vv1[cu][i - 1] % mod;
    }
    for (i = g[cu].size() - 2; i >= 0; i--) {
        vv2[cu][i] = vv2[cu][i] * vv2[cu][i + 1] % mod;
    }
    for (i = 0; i < g[cu].size(); i++) {
        if (g[cu][i] != fr) {
            l = r = 1;
            if (i > 0) {
                l = vv1[cu][i - 1] * vcom1[cu][i - 1] % mod;
            }
            if (i < g[cu].size() - 1) {
                r = vv2[cu][i + 1] * vcom2[cu][i + 1] % mod;
            }
            nva = l * r % mod;
            if (i > 0) nva = nva * com(n - 1 - vs[cu][i], vs1[cu][i - 1]) % mod;
            dfs2(cu, g[cu][i], nva);
        }
    }
}

int main(void) {
    int i, a, b;

    scanf("%d", &n);
    for (i = 0; i < n - 1; i++) {
        scanf("%d%d", &a, &b);
        g[a - 1].push_back(b - 1);
        g[b - 1].push_back(a - 1);
        vs[a - 1].push_back(0);
        vs[b - 1].push_back(0);
        vs1[a - 1].push_back(0);
        vs1[b - 1].push_back(0);
        vs2[a - 1].push_back(0);
        vs2[b - 1].push_back(0);
        vcom1[a - 1].push_back(1);
        vcom1[b - 1].push_back(1);
        vcom2[a - 1].push_back(1);
        vcom2[b - 1].push_back(1);
        vv1[a - 1].push_back(1);
        vv1[b - 1].push_back(1);
        vv2[a - 1].push_back(1);
        vv2[b - 1].push_back(1);
    }

    cominit(n);

    dfs_vs(-1, 0);

    dfs1(-1, 0);

    dfs2(-1, 0, 0);

    for (i = 0; i < n; i++) {
        printf("%lld\n", vv2[i][0] * vcom2[i][0] % mod);
    }

    return 0;
}

Measured memory_bytes: 103836