#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
#define peak        9123372036854775807
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class x,class y> x sum(x a,y b){return a+b;}
template<class x,class y> x mul(x a,y b){return a*b;}
template<class x,class y> x sub(x a,y b){return a-b;}
template<class x,class y> x divi(x a,y b){return a/b;}

template<class x,class y>
istream &operator>>(istream &in,pair<x,y> &p) 
{ 
    in>>p.F>>p.S;
    return in;
}
template<class x>
istream &operator>>(istream &in,vector<x> &v) 
{
    for(auto& i:v)
        in>>i;
    return in;
}
template<class x,class y>
ostream &operator<<(ostream &out,pair<x,y> &p) 
{ 
    out<<"("<<p.F<<","<<p.S<<") ";
    return out; 
}
template<class x>
ostream &operator<<(ostream &out,vector<x> &v) 
{ 
    out<<v.size()<<endl;
    for(auto i:v)
        out<<i<<" ";
    out<<endl;
    return out; 
}
#define N  200005

vi v[N],noc(N,0),cw(N,0),ans(N,0),fac(N,0);
ll vis[N],n;

ll expo(ll base, ll exponent, ll mod) {								//return base^exponent modulo modulus
    ll ans = 1;
    while(exponent !=0 ) {
        if((exponent&1) == 1) {
            ans = ans*base ;
            ans = ans%mod;
        }
        base = base*base;
        base %= mod;
        exponent>>= 1;
    }
    return ans%mod;
}

ll com(ll n,ll r)
{
	ll ans=fac[n];
	ans=(ans*expo(fac[n-r],hell-2,hell))%hell;
	ans=(ans*expo(fac[r],hell-2,hell))%hell;
	return ans;
}

ll dfsnoc(ll x)
{
	vis[x]=1;
	ll y=0;
	for(auto i:v[x])
	{
		if(vis[i]==1)
			continue;
		y+=dfsnoc(i);
	}
	noc[x]=y+1;
	return y+1;
}

ll dfscw(ll x)
{
	vis[x]=1;
	ll y=1,nn=noc[x]-1;
	for(auto i:v[x])
	{
		if(vis[i]==1)
			continue;
		ll cx=dfscw(i);
		ll yy=(com(nn,noc[i])*cw[i])%hell;
		nn=nn-noc[i];
		y=(y*yy)%hell;
	}
	cw[x]=y;
	return y;
}

void dfsans(ll x,ll val)
{
	vis[x]=1;
	ll tans=(val*cw[x])%hell;
	ans[x]=tans;
	for(auto i:v[x])
	{
		if(vis[i]==1)
			continue;
		ll xx=(tans*expo(cw[i],hell-2,hell))%hell;
		ll yy=com(n-1,noc[i]);
		ll yyy=(expo(yy,hell-2,hell)*xx)%hell;
		yyy=(com(n-1,n-noc[i])*yyy)%hell;
		// ll yy=(com(n-1,noc[i])*xx)%hell;
		dfsans(i,yyy);
	}
}

int main()
{
    ios;
    ll tt=1;
    // cin>>tt;
    while(tt--)
    {
    	ll i,j,k,l,m;
    	cin>>n;
    	fac[0]=1;
    	for(i=1;i<=n+3;i++)
    		fac[i]=(fac[i-1]*i)%hell;
    	for(i=0;i<n-1;i++)
    	{
    		cin>>l>>m;
    		v[l].pb(m);
    		v[m].pb(l);
    	}
    	clr(vis,0);
    	dfsnoc(1);
    	clr(vis,0);
    	dfscw(1);
    	clr(vis,0);
    	dfsans(1,1);
    	// for(i=1;i<=n;i++)
    	// 	cout<<cw[i]<<" ";
    	// cout<<endl;
    	for(i=1;i<=n;i++)
    		cout<<ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 22512