#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define p(a) printf("%lld\n",a);
ll n;
const ll mod=1e9+7;
vector<ll> g[200005];
bool used[200005]={0};
ll size[200005]={0};
ll njie[200005]={0};
ll nfan[200005]={0};
ll sum[200005]={0};
ll a[200005]={0};
ll qpow(ll a,ll b)
{
	if(b==0) return 1;
	else if(b==1) return a;
	ll c=qpow(a,b/2);
	if(b%2==0) return c*c%mod;
	else return c*c%mod*a%mod;
}
void dfs1(ll u)
{	//printf("%lld ",u);
	used[u]=true;
	for(ll i=0;i<g[u].size();i++)
	{
		ll v=g[u][i];
		if(used[v]) continue;
		dfs1(v);
		size[u]+=size[v];
		a[u]=a[u]*a[v]%mod*nfan[size[v]]%mod;
	}
	a[u]=a[u]*njie[size[u]-1]%mod;
}
void change(ll u,ll v)
{
	a[u]=a[u]*nfan[size[u]-1]%mod;
	a[u]=a[u]*njie[size[u]-size[v]-1]%mod;
	a[u]=a[u]*njie[size[v]]%mod;
	a[u]=a[u]*qpow(a[v],mod-2)%mod;
	size[u]=size[u]-size[v];
	a[v]=a[v]*nfan[size[v]-1]%mod;
	size[v]=size[v]+size[u];
	a[v]=a[v]*njie[size[v]-1]%mod;
	a[v]=a[v]*a[u]%mod;
	a[v]=a[v]*nfan[size[u]]%mod;
}
void dfs2(ll u)
{
	sum[u]=a[u];
	used[u]=true;
	for(ll i=0;i<g[u].size();i++)
	{
		ll v=g[u][i];
		if(!used[v])
		{
			change(u,v);
			dfs2(v);
			change(v,u);
		}
	}
}
int main()
{
	scanf("%lld",&n);
	njie[0]=1;
	for(ll i=1;i<=n;i++) njie[i]=njie[i-1]*i%mod,a[i]=1,size[i]=1;
	nfan[n]=qpow(njie[n],mod-2);
	for(ll i=n-1;i>0;i--) nfan[i]=nfan[i+1]*(i+1)%mod;
	nfan[0]=nfan[1];
	for(ll i=0;i<n-1;i++)
	{
		ll u,v;
		scanf("%lld%lld",&u,&v);
		g[u].push_back(v);
		g[v].push_back(u);
	}
	dfs1(1);
	memset(used,0,sizeof(used));
	dfs2(1);
	for(ll i=1;i<=n;i++)
	{
		printf("%lld ",sum[i]);
	}
}