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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) { ll d = euclid(b, a % b, y, x);
        return y -= a/b * x, d; }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1) ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(): x(0) {}
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1); return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e) return Mod(1);
        Mod r = *this ^ (e / 2); r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

int n;
int treesize[200005];
Mod dp[200005];
vi G[200005];
Mod fact[200005];
Mod fans[200005];

Mod ncr(int n, int r) {
    return fact[n] / fact[r] / fact[n - r];
}

void dfs1(int x, int p = -1) {
    treesize[x] = 0;
    dp[x] = 1;
    for (int h : G[x]) if (h != p) {
        dfs1(h, x);
        treesize[x] += treesize[h];
        dp[x] = dp[x] * dp[h] * ncr(treesize[x], treesize[h]);
    }
    treesize[x]++;
}

void dfs2(int x, int p = -1) {
    fans[x] = dp[x];
//    cout << x << ": ";
//    rep(i, 1, n + 1) cout << dp[i].x << " "; cout << endl;
    for (int h : G[x]) if (h != p) {
        // swap h and x
        Mod BA, BB; int BC, BD;
        BA = dp[x], BB = dp[h], BC = treesize[x], BD = treesize[h];
        dp[x] = dp[x] / (dp[h] * ncr(treesize[x] - 1, treesize[h]));
        treesize[x] -= treesize[h];
        treesize[h] += treesize[x];
        dp[h] = dp[h] * (dp[x] * ncr(treesize[h] - 1, treesize[x]));
//        cout << "Swap " << x << " " << h << endl;
//        cout << "dp[x] is now " << dp[x].x << endl;
//        cout << "dp[h] is now " << dp[h].x << endl;
//        cout << "treesize[x] is now " <<treesize[x] << endl;
//        cout << "treesize[h] is now " << treesize[h] << endl;
        dfs2(h, x);
        dp[x] = BA, dp[h] = BB, treesize[x] = BC, treesize[h] = BD;
    }
}

int main() {
    cin.sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit);

    fact[0] = fact[1] = 1;
    rep(i, 2, 200005) fact[i] = fact[i - 1] * i;

    cin >> n;
    rep(i, 1, n) {
        int x, y; cin >> x >> y;
        G[x].push_back(y); G[y].push_back(x);
    }
    dfs1(1);
    dfs2(1);
    rep(i, 1, n + 1) {
        cout << fans[i].x << endl;
    }
}

Measured memory_bytes: 19444