#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>

#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long

const int INF = 1e18;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順
//cout << fixed << setprecision(10) << ans << endl;
//int gcd(int a,int b){return b?gcd(b,a%b):a;}

//二項係数ここから (1 <= k <= n <10^7 程度なら使える)
//COMinit(); を書くのを忘れない
const int MAX = 2100000;
const int MOD = 1000000007;

int fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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;
    }
}

// 二項係数計算
int COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
//二項係数ここまで


int mypow(int _x, int _n, int _p){
        int ret = 1;
        while(0 < _n){
            if((_n % 2) == 0){
                _x *= _x;
                _x %= _p;	
                _n >>= 1;
            }
            else{
                ret *= _x;
                ret %= _p;
                --_n;
            }
        }
        return ret;
    }

int div(int _a,int _b,int _MOD){
    return ((_a% _MOD) * mypow(_b, _MOD-2, _MOD))% _MOD;
}



int ki_size[300000];
int ans1[300000];
vector<int> edge[300000];
vector<int> nsize[300000];

int ans[300000];
int n;


void dfs(int s,int p){
    int nans = 1;
    ki_size[s] = 1;
    
    REP(i,edge[s].size()){
        int ne = edge[s][i];
        if(ne == p) continue;
        dfs(ne,s);
        nsize[s].pb(ki_size[ne]);
        ki_size[s] += ki_size[ne];
        nans *= ans1[ne];
        nans %= MOD;
    }
    int nnsize = ki_size[s]-1;
    REP(i,nsize[s].size()){
        int pp = nsize[s][i];
        nans *= COM(nnsize,pp);
        nans %= MOD;
        nnsize -= pp;
    }
    ans1[s] = nans;
}

void dfs2(int s,int p){
    if(s==0){
        ans[s] = ans1[s];
        REP(i,edge[s].size()){
            dfs2(edge[s][i],s);
        }
    }
    else{
        int ansp = div(ans[p],COM(n-1,ki_size[s]) * ans1[s] % MOD,MOD);
        ans[s] = 1;
        REP(i,edge[s].size()){
            int ne = edge[s][i];
            if(ne == p) continue;
            ans[s] *= ans1[ne];
            ans[s] %= MOD;
        }
        int nnsize = n-1;
        REP(i,nsize[s].size()){
            int pp = nsize[s][i];
            ans[s]  *= COM(nnsize,pp);
            ans[s]  %= MOD;
            nnsize -= pp;
        }
        ans[s] *= ansp;
        ans[s] %= MOD;
        REP(i,edge[s].size()){
            if(edge[s][i] == p) continue;
            dfs2(edge[s][i],s);
        }
    }    
}

signed main(){
    COMinit();
    
    cin >> n;
    REP(i,n-1){
        int a1,b1;
        cin >> a1 >> b1;
        a1 --;
        b1 --;
        edge[a1].pb(b1);
        edge[b1].pb(a1);
    }
    dfs(0,0);
    dfs2(0,0);
    REP(i,n){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 83584