#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

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

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
#define endl '\n'

using ll = long long;
using db = long double;
using ii = pair<int, int>;

const int N = 2e5 + 5, LG = 19, MOD = 1e9 + 7;
const int SQ =225;
const long double EPS = 1e-7;
vector<int> adj[N];
int n;
int dpD[N];
int dpU[N];
int sz[N];
int F[N + N];
int iF[N + N];
int fast(int b, int e){
    int res = 1;
    for(;e;e >>= 1, b = 1ll * b * b % MOD)
        if(e & 1)
            res = 1ll * res * b % MOD;
    return res;
}
int C(int n, int k){
    if(k > n)return 0;
    return 1ll * F[n] * iF[k] % MOD * iF[n-k] % MOD;
}
int StarsAndBars(int ArraySize, int AddSize){
    return C(ArraySize + AddSize, AddSize);
}
void init() {

    F[0] = iF[0] = 1;

    f(i,1,N + N){
        F[i] = 1ll * i * F[i-1] % MOD;
        iF[i] = fast(F[i], MOD - 2);
    }

}
vector<int> prefix[N], suffix[N];
vector<int> prefixSz[N], suffixSz[N];
void dfs(int node, int par){

    dpD[node] = 1;

    if(node != par)
        adj[node].erase(find(adj[node].begin(), adj[node].end(), par));

    for(auto child : adj[node]){

        dfs(child, node);

        dpD[node] = 1ll * dpD[node] * dpD[child] % MOD * StarsAndBars(sz[node], sz[child]) % MOD;
        sz[node] += sz[child];
        prefix[node].pb(dpD[node]);
        prefixSz[node].pb(sz[node]);

    }

    reverse(adj[node].begin(), adj[node].end());

    int curSz = 0;
    int curDp = 1;

    for(auto child : adj[node]){

        curDp = 1ll * curDp * dpD[child] % MOD * StarsAndBars(curSz,sz[child]) % MOD;
        curSz += sz[child];
        suffix[node].pb(curDp);
        suffixSz[node].pb(curSz);

    }
    reverse(suffix[node].begin(), suffix[node].end());
    reverse(suffixSz[node].begin(), suffixSz[node].end());
    reverse(adj[node].begin(), adj[node].end());
    sz[node]++;

}
int ans[N];

void dfs2(int node){

    for(int i = 0; i < adj[node].size(); i++){

        int curDp = dpU[node];
        int curSZ = sz[1] - sz[node];

        if(i != 0){
            curDp = 1ll * curDp * prefix[node][i-1] % MOD * StarsAndBars(curSZ, prefixSz[node][i-1]) % MOD;
            curSZ += prefixSz[node][i-1];
        }
        if(i + 1 != adj[node].size()){
            curDp = 1ll * curDp * suffix[node][i+1] % MOD * StarsAndBars(curSZ, suffixSz[node][i+1]) % MOD;
            curSZ += suffixSz[node][i+1];
        }


        dpU[adj[node][i]] = curDp;
        dfs2(adj[node][i]);

    }

//    cout<<node<<' '<<dpU[node]<<' '<<dpD[node] << ' ' << 1ll * dpU[node] * dpD[node] % MOD * StarsAndBars(sz[node]-1, sz[1] - sz[node])%MOD<<'\n';
    ///merge dpU[node] and dpD[node]
    ans[node] = 1ll * dpU[node] * dpD[node] % MOD * StarsAndBars(sz[node]-1, sz[1] - sz[node])%MOD;

}
int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    init();

    cin >> n;

    f(i,1,n){
        int u, v;
        cin >> u >> v;
        adj[u].pb(v);
        adj[v].pb(u);
    }

    dfs(1, 1);
    dpU[1] = 1;
    dfs2(1);

  f(i,1,n+1)cout<<ans[i]<<'\n';



  return 0;
}


Measured memory_bytes: 54272