#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define N 1000000007
#define N2 998244353
#define Nmax 600005
#define INF (ll)1e18
#define pll pair<ll,ll>
#define mp make_pair
#define fi first
#define se second
#define vv vector
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(ll i=m;i<(n);i++)
#define repr(i,n) repr2(i,n,0)
#define repr2(i,m,n) for(ll i=m;i>=(n);i--)
#define get(n) ll (n); scanf("%lld",&(n));
#define get2(n,k) ll (n),(k); scanf("%lld%lld",&(n),&(k));
#define get3(n,m,k) ll (n),(m),(k); scanf("%lld%lld%lld",&(n),&(m),&(k));
#define gets(s) string (s); cin >> (s);
#define ALL(c) (c).begin(),(c).end()
#define fill_nums(A,n) vector<ll> A((n)); for(ll i=0;i<n;i++) scanf("%lld",&A[i]);
#define fill_edges(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1); adj[b-1].pb(a-1);}
#define fill_direct(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1);}
#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); //cout.tie(0);
#define pi 3.1415926535897
#define db long double  /* print with %Lf */
#define EPS 1e-9
#define flu fflush(stdout)
#define imp {cout<<"0\n"; return 0;}
#define yup {cout<<"YES\n"; return 0;}
#define debug_vec(vec,n) {rep(idxi,n) cout<<vec[idxi]<<" "; cout<<"\n";}
#define debug_pvec(vec,n) {rep(idxi,n) cout<<vec[idxi].fi<<"-"<<vec[idxi].se<<"  "; cout<<"\n";}
#define debug_set(seta) {cout<<seta.size()<<"\n"; for(auto idxi:seta) cout<<idxi<<" "; cout<<"\n";}
#define debug_map(mappa) {cout<<mappa.size()<<"\n";for(auto idxi:mappa) cout<<idxi.fi<<"-"<<idxi.se<<"  "; cout<<"\n";}
#define debug_vecvec(vec,n) {rep(idxi,n) {for(auto idxi2:vec[idxi]) cout<<idxi2<<" "; cout<<"\n";}}

vector<ll> facts, invfacts;

ll power(ll x, ll n, ll d) {
    ll val = (x%d), res = 1;
    while(n>0) {
        if(n&1)
            res = (res*val)%d;
        val = (val*val)%d;
        n = n>>1;
    }
    return (res+d)%d;
}

ll nck(ll n, ll k, ll d) {
    if(k>n)
        return 0;
    return (facts[n]*invfacts[k]%d*invfacts[n-k]%d+d)%d;
}

void initialize_facts(ll n, ll mod) {
    facts.resize(n+1);
    invfacts.resize(n+1);
    facts[0] = 1;
    invfacts[0] = 1;

    for(ll i=1;i<=n;i++) {
        facts[i] = (facts[i-1]*i)%mod;
        invfacts[i] = power(facts[i], mod-2, mod);
    }
}

ll invfact(ll num) {
	return power(num, N-2, N);
}

vector<ll> dp(Nmax,1), dp2(Nmax,1);
vector<ll> sz(Nmax,1);

void dfs_tree(ll idx, ll par, vector<vector<ll>> &adj) {
        
    if(adj[idx].size()==1 && par!=-1) {
        return;
    }

    for(auto i:adj[idx]) {
        if(i!=par) {
            dfs_tree(i,idx,adj);
            sz[idx] += sz[i];
        }
    }

    ll tot = sz[idx]-1;
    for(auto i:adj[idx]) {
        if(i!=par) {
        	dp[idx] = dp[idx] * dp[i] % N * nck(tot,sz[i],N) % N;
            tot -= sz[i];
        }
    }
}

void dfs_tree2(ll idx, ll par, vector<vector<ll>> &adj) {
        
    dp2[idx] = dp[idx];

    for(auto i:adj[idx]) {
        if(i!=par) {

        	dp[idx] = dp[idx] * invfact(nck(sz[idx]-1,sz[i],N)) % N * invfact(dp[i]) % N;
        	sz[idx] -= sz[i];

        	sz[i] += sz[idx];
        	dp[i] = dp[i] * dp[idx] % N * nck(sz[i]-1,sz[idx],N) % N;

            dfs_tree2(i,idx,adj);

            dp[i] = dp[i] * invfact(dp[idx]) % N * invfact(nck(sz[i]-1,sz[idx],N)) % N;
            sz[i] -= sz[idx];

            sz[idx] += sz[i];
			dp[idx] = dp[idx] * nck(sz[idx]-1,sz[i],N) % N * dp[i] % N;
        }
    }
}

int main() {
	initialize_facts(Nmax, N);

	get(n);
	vv<vv<ll>> adj(n);
	fill_edges(adj, n-1);

	dfs_tree(0, -1, adj);
	dfs_tree2(0, -1, adj);

	rep(i,n) 
		printf("%lld\n", dp2[i]);

	return 0;
}

Measured memory_bytes: 38128