#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define gc getchar_unlocked()
#define pc(x) putchar_unlocked(x)
template<typename T> void scan(T &x){x = 0;bool _=0;T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printn(T n){bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=n%10+48;n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);}
template<typename First, typename ... Ints> void scan(First &arg, Ints&... rest){scan(arg);scan(rest...);}
template<typename T> void print(T n){printn(n);pc(10);}
template<typename First, typename ... Ints> void print(First arg, Ints... rest){printn(arg);pc(32);print(rest...);}

using namespace std;
using ll = long long;
using pii = pair<int, int>;
constexpr int MM = 2e5+2;
const ll mod = 1e9+7;

ll gcd(ll gcd_a, ll gcd_b){return gcd_b == 0 ? gcd_a : gcd(gcd_b, gcd_a % gcd_b);}
ll fpow(ll fpow_b, ll fpow_exp, ll fpow_mod){if(fpow_exp == 0) return 1;ll t = fpow(fpow_b,fpow_exp/2,fpow_mod);if(fpow_exp&1) return t*t%fpow_mod*fpow_b%fpow_mod;return t*t%fpow_mod;}
ll divmod(ll divmod_i, ll divmod_j, ll divmod_mod){divmod_i%=divmod_mod,divmod_j%=divmod_mod;return divmod_i*fpow(divmod_j,divmod_mod-2,divmod_mod)%divmod_mod;}

ll f[MM], inv[MM];

ll val(int n, int k){
    if(n == k)
        return 1;
    if(n < k)
        return 0;
    return ((f[n]*inv[k]%mod)*inv[n-k])%mod;
}

int n, sz[MM];
vector<int> adj[MM];
ll up[MM], down[MM], ans[MM];
//propagate

int dfs(int cur, int pre){
    sz[cur] = 1;
    for(int u: adj[cur]){
        if(u != pre)
            sz[cur] += dfs(u, cur);
    }
    return sz[cur];
}

void go(int cur, int pre){
    vector<pii> v;
    for(int u: adj[cur]){
        if(u == pre)
            continue;
        go(u, cur);
        v.emplace_back(sz[u], u);
    }
    if(pre){
        int sp = n-sz[cur];
        v.emplace_back(sp, pre);
    }
    
    ll a = 1;
    int tot = n-1;
    for(auto i: v){
        a = a*val(tot, i.first)%mod;
        tot -= i.first;
    }
    ans[cur] = a;
    
    for(auto i: v){
        int sub = i.second;
        
        ll ex = val(n-1, i.first);
        ll in = fpow(ex, mod-2, mod);
        
        a = a*in%mod;
        
        if(sub == pre)
            up[cur] = up[cur]*a%mod; //watch out
        else
            down[sub] = down[sub]*a%mod;
        
        a = a*ex%mod;
    }
}

void mulmod(ll &a, ll b){
    a = a*b%mod;
}

void prop(int cur, int pre){
    mulmod(down[cur], down[pre]);
    mulmod(ans[cur], down[cur]);
    
    mulmod(ans[cur], fpow(up[cur], mod-2, mod));
    //to undo
    
    for(int u: adj[cur]){
        if(u == pre)
            continue;
        prop(u, cur);
        mulmod(up[cur], up[u]);
    }
    mulmod(ans[cur], up[cur]);
//    printerr("p", cur, down[cur], up[cur]);
}

void fin(int cur, int pre){
    mulmod(down[cur], down[pre]);
    mulmod(ans[cur], down[cur]);
    
    ll v = 1;
    for(int u: adj[cur]){
        if(u != pre)
            mulmod(v, up[u]);
    }
    for(int u: adj[cur]){
        if(u != pre){
            v = v*fpow(up[u], mod-2, mod)%mod;
            down[u] = v;
            fin(u, cur);
            v = v*up[u]%mod;
        }
    }
}

int main(){
    scan(n);
    for(int i = 0,a,b; i < n-1; i++){
        scan(a, b);
        adj[a].emplace_back(b);
        adj[b].emplace_back(a);
    }
    f[1] = inv[1] = 1;
    for(int i = 2; i <= n; i++){
        f[i] = f[i-1]*i%mod;
        inv[i] = fpow(f[i], mod-2, mod);
    }
    for(int i = 0; i <= n; i++)
        up[i] = down[i] = 1;
    dfs(1, 0);
    go(1, 0);
    prop(1, 0);
    for(int i = 0; i <= n; i++)
        down[i] = 1;
    fin(1, 0);
    
    for(int i = 1; i <= n; i++)
        print(ans[i]);
    
    return 0;
}

Measured memory_bytes: 22772