#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
#define mod 1000000007
#define MOD 998244353
#define INF 40000000000000000
int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
int dx4[4] = {-1, 0, 1, 0};
int dy4[4] = {0, -1, 0, 1};
template <class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
int extgcd(int a, int b, int &x, int &y) {
    int d = a;
    if(b != 0) {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    } else {
        x = 1;
        y = 0;
    }
    return d;
}
int mod_inverse(int a, int mm) {
    int x, y;
    extgcd(a, mm, x, y);
    return (mm + x % mm) % mm;
}

using Graph = vector<vector<int>>;
int N;
Graph G;
Graph CC;
Graph dp;
vector<int> fac(200010);
int count0(int now, int p = -1) {
    int s = G[now].size();
    CC[now].assign(s, -1);
    int res = 0;
    rep(i, s) {
        int to = G[now][i];
        if(to == p) continue;
        CC[now][i] = count0(to, now);
        res += CC[now][i];
    }
    return res + 1;
}
void count1(int now, int pval = 0, int p = -1) {
    int s = G[now].size();
    rep(i, s) {
        if(G[now][i] == p) CC[now][i] = pval;
    }
    int sum = pval + 1;
    rep(i, s) {
        if(G[now][i] == p) continue;
        sum += CC[now][i];
    }
    rep(i, s) {
        int to = G[now][i];
        if(to == p) continue;
        count1(to, sum - CC[now][i], now);
    }
}

int rec(int now, int p = -1) {
    int s = G[now].size();
    dp[now].assign(s, -1);
    int res = 1;
    int c = 0;
    rep(i, s) {
        int to = G[now][i];
        if(to == p) continue;
        dp[now][i] = rec(to, now);
        res = (res * dp[now][i]) % mod;
        res = (res * mod_inverse(fac[CC[now][i]], mod)) % mod;
        c += CC[now][i];
    }
    res = (res * fac[c]) % mod;
    return res;
}
void rerec(int now, int pval = 1, int p = -1) {
    int s = G[now].size();
    rep(i, s) {
        if(G[now][i] == p) dp[now][i] = pval;
    }
    int res = 1;
    int c = 0;
    rep(i, s) {
        res = (res * dp[now][i]) % mod;
        res = (res * mod_inverse(fac[CC[now][i]], mod)) % mod;
        c += CC[now][i];
    }
    rep(i, s) {
        int to = G[now][i];
        if(to == p) continue;
        rerec(to, res * fac[CC[now][i]] % mod * mod_inverse(dp[now][i], mod) % mod * fac[c - CC[now][i]] % mod, now);
    }
}
int solve(int now) {
    int s = G[now].size();
    int res = 1, c = 0;
    rep(i, s) {
        res = (res * mod_inverse(fac[CC[now][i]], mod)) % mod;
        res = (res * dp[now][i]) % mod;
        c += CC[now][i];
    }
    return res * fac[c] % mod;
}
signed main() {
    cin >> N;
    G.assign(N, vector<int>());
    CC.assign(N, vector<int>());
    dp.assign(N, vector<int>());
    fac[0] = 1;
    rep(i, 200005) fac[i + 1] = (fac[i] * (i + 1)) % mod;
    rep(i, N - 1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    count0(0);
    count1(0);
    rec(0);
    rerec(0);
    rep(i, N) cout << solve(i) << endl;
}


Measured memory_bytes: 41328