#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define inf (int)(3e18)
#define all(v) v.begin(),v.end()
#define mod (int)(1e9+7)

template<class T> inline void chmin(T &a, T b) {
	a = min(a, b);
}
template<class T> inline void chmax(T &a, T b) {
	a = max(a, b);
}

int mod_pow(int x, int y, int m = mod) {
	int res = 1;
	x %= m;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int perm[1000005];
void init_perm(){
	perm[0]=1;
	REP(i,1000005)perm[i]=perm[i-1]*i%mod;
}
int nCk(int x,int y){
	if(x<y)return 0;
	return perm[x]*mod_pow(perm[x-y],mod-2)%mod*mod_pow(perm[y],mod-2)%mod;
}

int N;
int ansdown[200005],cntdown[200005];
int ansup[200005],cntup[200005];
vector<int>G[200005];
bool used[200005];
void dfs1(int x,int par){
	cntdown[x]=1;
	for(int i:G[x])if(i!=par){
		dfs1(i,x);
		cntdown[x]+=cntdown[i];
	}
	ansdown[x]=1;
	int now=cntdown[x]-1;
	for(int i:G[x])if(i!=par){
		ansdown[x]*=nCk(now,cntdown[i])*ansdown[i]%mod;
		ansdown[x]%=mod;
		now-=cntdown[i];
	}
}
int ans[200005];
void dfs2(int x,int par){
	ans[x]=ansup[x]*nCk(N-1,N-cntdown[x])%mod;
	ans[x]*=ansdown[x];
	ans[x]%=mod;
	for(int i:G[x])if(i!=par){
		ansup[i]=ans[x]*mod_pow(nCk(N-1,cntdown[i]),mod-2)%mod*mod_pow(ansdown[i],mod-2)%mod;
		dfs2(i,x);
	}
}
signed main() {
	init_perm();
	cin>>N;
	rep(i,N-1){
		int a,b;cin>>a>>b;a--;b--;
		G[a].push_back(b);G[b].push_back(a);
	}
	dfs1(0,0);
	ansup[0]=1;
	dfs2(0,0);
	rep(i,N)cout<<ans[i]<<endl;
}

