#include<bits/stdc++.h>
#define maxn 1000005
using namespace std;
const int mod = 1000000007;
int n;
vector<int> g[maxn];
int fac[maxn],inv[maxn];
int dp[maxn],sz[maxn],Ans[maxn];
int fastpow(int a,int p)
{
	int ans=1;
	for(;p;p>>=1,a=1ll*a*a%mod)if(p&1)ans=1ll*ans*a%mod;
	return ans; 
}
int C(int x,int y)
{
	return 1ll*fac[x]*inv[y]%mod*inv[x-y]%mod;
}
void dfs(int u,int f)
{
	dp[u]=1;
	for(int v:g[u])if(v!=f)
	{
		dfs(v,u);
		dp[u]=1ll*dp[v]*dp[u]%mod*C(sz[u]+sz[v],sz[v])%mod;
		sz[u]+=sz[v];
	}
	sz[u]+=1;
}
void dfs2(int u,int f)
{
	for(int v:g[u])if(v!=f)
	{
		int t=1ll*Ans[u]*fastpow(dp[v],mod-2)%mod*fastpow(C(n-1,sz[v]),mod-2)%mod;
		Ans[v]=1ll*Ans[u]*fastpow(C(n-1,sz[v]),mod-2)%mod*C(n-1,sz[v]-1)%mod; 
		dfs2(v,u);
	}
}
int main()
{
	fac[0]=inv[0]=1;
	for(int i=1;i<=1000000;++i)fac[i]=1ll*fac[i-1]*i%mod,inv[i]=fastpow(fac[i],mod-2);
	scanf("%d",&n);
	for(int i=1;i<n;++i)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		g[u].push_back(v);g[v].push_back(u);
	}
	dfs(1,0);
	Ans[1]=dp[1];
	dfs2(1,0);
	for(int i=1;i<=n;++i)printf("%d\n",Ans[i]); 
}