#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 200007

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;
}

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

int dfs_vs(int fr, int cu) {
    int i, ch, fri, vss;
    ch = g[cu].size();
    fri = -1;
    for (i = 0; i < ch; i++) {
        if (g[cu][i] == fr) {
            fri = i;
        }
    }
    vss = 0;
    for (i = 0; i < ch; i++) {
        if (i != fri) {
            vs[cu][i] = dfs_vs(cu, g[cu][i]);
            vss += vs[cu][i];
            vfac1[cu][i] = finv[vs[cu][i]];
        }
    }
    for (i = 0; i < ch; i++) {
        if (i == fri) {
            vs[cu][i] = n - 1 - vss;
            vfac1[cu][i] = finv[vs[cu][i]];
            break;
        }
    }
    for (i = 0; i < ch; i++) {
        vs1[cu][i] = vs2[cu][i] = vs[cu][i];
        vfac2[cu][i] = vfac1[cu][i];
    }
    for (i = 1; i < ch; i++) {
        vs1[cu][i] += vs1[cu][i - 1];
        vfac1[cu][i] = vfac1[cu][i] * vfac1[cu][i - 1] % mod;
    }
    for (i = ch - 2; i >= 0; i--) {
        vs2[cu][i] += vs2[cu][i + 1];
        vfac2[cu][i] = vfac2[cu][i] * vfac2[cu][i + 1] % mod;
    }
    return vss + 1;
}

ll dfs1(int fr, int cu) {
    int i, ch, fri;
    ll res;
    ch = g[cu].size();
    fri = -1;
    for (i = 0; i < ch; i++) {
        if (g[cu][i] == fr) {
            fri = i;
        }
    }
    if (fri >= 0) {
        res = fac[n - 1 - vs[cu][fri]];
    }
    else {
        res = 0;
    }
    for (i = 0; i < ch; i++) {
        if (i != fri) {
            vv1[cu][i] = dfs1(cu, g[cu][i]);
            res = res * vv1[cu][i] % mod * finv[vs[cu][i]] % mod;
        }
    }
    return res;
}

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

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

    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);
        vv1[a - 1].push_back(1);
        vv1[b - 1].push_back(1);
        vv2[a - 1].push_back(1);
        vv2[b - 1].push_back(1);
        vfac1[a - 1].push_back(1);
        vfac1[b - 1].push_back(1);
        vfac2[a - 1].push_back(1);
        vfac2[b - 1].push_back(1);
    }

    cominit(n);

    dfs_vs(-1, 0);

    dfs1(-1, 0);

    dfs2(-1, 0, 0);

    for (i = 0; i < n; i++) {
        pans = vv2[i][0] * vfac2[i][0] % mod * fac[n - 1] % mod;
        printf("%lld\n", pans);
    }

    return 0;
}

Measured memory_bytes: 103836