#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e8;
const ll INF = 1e16;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

const int MAX_N = 5e5;
ll fac[MAX_N+1], ifac[MAX_N+1], inv[MAX_N+1];

//mpow(x,n)で(x^n)をO(log(n))で計算
ll mpow(ll x, ll n){
    ll res = 1, now = x;
    while(n > 0){
        if(n & 1) res *= now, res %= MOD;
        now *= now, now %= MOD;
        n >>= 1;
    }
    return res;
}

//setcomb()でfac,ifac,invを全て計算
void setcomb(){
    rep2(i, 1, MAX_N){
        inv[i] = mpow(i, MOD-2);
    }
    //i!とi!の逆元
    fac[0] = 1, ifac[0] = 1;
    rep2(i, 1, MAX_N){
        fac[i] = (fac[i-1]*i) % MOD;
        ifac[i] = (ifac[i-1]*inv[i]) % MOD;
    }
}

//comb(n, k)でnCk
ll comb(int n, int k){
    ll c = fac[n];
    c *= ifac[n-k], c %= MOD;
    c *= ifac[k], c %= MOD;
    return c;
}

//perm(n, k)でnPk
ll perm(int n, int k){
    return(fac[n]*ifac[n-k])%MOD;
}

const int MAX_V = 2e5;
vector<int> es[MAX_V];
bool used[MAX_V];
int par[MAX_V], size[MAX_V];
ll num[MAX_N];

ll c(vector<int> v){
    int sum = 0;
    ll res = 1;
    for(auto &e: v) sum += size[e];
    for(auto &e: v){
        res *= comb(sum, size[e]), res %= MOD;
        sum -= size[e];
    }
    return res;
}

int dfs1(int now){
    used[now] = true;
    for(auto &e: es[now]){
        if(used[e]) continue;
        par[e] = now;
        size[now] += dfs1(e); 
    }
    return size[now];
}
 
ll dfs2(int now){
    used[now] = true;
    vector<int> v;
    ll res = 1;
    for(auto &e: es[now]){
        if(used[e]) continue;
        v.pb(e);
        res *= dfs2(e), res %= MOD;
    }
    res *= c(v), res %= MOD;
    num[now] = res;
    return res;
}

int main(){
    setcomb();
    int N;
    cin >> N;
    //まずは0を根として垂らす
    rep(i, N-1){
        int u, v;
        cin >> u >> v;
        u--, v--;
        es[u].pb(v);
        es[v].pb(u);
    }
    par[0] = -1;
    fill(size, size+N, 1);
    fill(used, used+N, false);
    dfs1(0);
    fill(used, used+N, false);
    dfs2(0);
    //rep(i, N) cout << par[i] << ' ' << size[i] << ' ' << num[i] << endl;
    ll up[N];
    up[0] = 1;
    queue<int> que;
    que.push(0);
    fill(used, used+N, false);
    used[0] = true;
    while(!que.empty()){
        int i = que.front();
        que.pop();
        for(auto &e: es[i]){
            if(!used[e]){
                que.push(e);
                used[e] = true;
            }
        }
        if(par[i] == -1) continue;
        int j = par[i];
        ll x = (comb(size[j]-1, size[i])*num[i])%MOD;
        x = mpow(x, MOD-2);
        ll b = (num[j]*x)%MOD;
        ll tmp = comb(N-1-size[i], size[j]-1-size[i]);
        tmp *= up[j], tmp %= MOD;
        tmp *= b, tmp %= MOD;
        up[i] = tmp;
    }
    rep(i, N){
        ll ans = comb(N-1, size[i]-1);
        ans *= num[i], ans %= MOD;
        ans *= up[i], ans %= MOD;
        cout << ans << endl;
    }
}

Measured memory_bytes: 33236