#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define bug1( x ) {cerr << (#x) <<"="<< x << endl;}
#define bug2( x , y ) {cerr << (#x) <<"="<< (x) << "    " << (#y) << "="<< (y) << endl;}
#define bug3( x , y , z ) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << endl;}
#define bug4( x , y , z , w) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << endl;}
#define bug5( x , y , z , w ,p) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << endl;}
#define bug6( x , y , z , w ,p , q) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << "    " << (#q) <<"="<< q << endl;}
#define bugn( x , n ) {cerr << (#x) <<":";for(int i=0;i<n;i++)cerr << x[i] <<"  "; cerr << endl;}
#define bugnm( x , n , m ) {cerr << (#x)<<endl;for(int i=0;i<n;i++){cerr << "Row #" << i<< ":";for(int j=0;j<m;j++)cerr << x[i][j] << "   ";cerr << endl;}}
typedef long long ll;
typedef long double ld;
using namespace std;

//  lets  (AAAAA..n1)(BBBB...n2)(CCC..n3).....
//  total permutaion = (n1+n2+...)!/( n1! n2! n3! ).
//  (AAAA.....n1) are subtree
//  It has their own permutaion which we have already calculated
//  dp(u) = [((n-1)!/(n1! * n2! ..) )] * [dp(v1) * dp(v2) * dp(v3)] ....
//  we know internal permuation : dp(v1) * dp(v2) * ...
//  but extrnal permutation only order matters so (n-1)!/( n1! n2! n3! .... )

const int maxn = 2e5+10, mod = 1e9+7;
vector<int>f(maxn),fi(maxn);
vector<int>g[maxn],dp(maxn),subtree(maxn),ans(maxn);
int n;
int binpow(int a,int p){
	int r = 1;
	while( p ){
		if( p & 1 ){
			r *= a;
			r %= mod;
		}
		a *= a;
		a %= mod;
		p >>= 1;
	}
	return r;
}

void dfs1(int u,int p){
	subtree[u]=1;
	for(auto v:g[u]){
		if( v != p ){
			dfs1(v,u);
			subtree[u]+=subtree[v];
		}
	}
	dp[u]=f[subtree[u]-1];
	for(auto v:g[u]){
		if( v != p ){
			dp[u] *= dp[v] * fi[ subtree[v] ] % mod;
			dp[u] %= mod;
		}
	}
	
}
void dfs2(int u,int p){
	int udp = dp[u], pdp = dp[p];
	int usub = subtree[u] , psub = subtree[p];
	if(p){
		dp[p] *= fi[ subtree[p] - 1] * binpow( dp[u] , mod-2 )% mod  * f[ subtree[u]] % mod;
		dp[p] %= mod;
		subtree[p] -= subtree[u];
		dp[p] *= f[ subtree[p] - 1 ];
		dp[p] %= mod;
		
		dp[u] *= fi[ subtree[u] - 1];
		dp[u] %= mod;
		subtree[u]+=subtree[p];
		dp[u] *= f[ subtree[u] - 1] * dp[p]  % mod * fi[ subtree[p] ] % mod;
		dp[u] %= mod;
	}
	ans[u]=dp[u];
	for(auto v:g[u]){
		if( v != p ){
			dfs2(v,u);
		}
	}
	if( p ){
		swap(udp,dp[u]);
		swap(pdp,dp[p]);
		swap(usub,subtree[u]);
		swap(psub,subtree[p]);
	}
}
	
int32_t main(){
	IOS
	f[0]=1;
	for(int i=1;i<maxn;i++){
		f[i]=(f[i-1]*i)%mod;
	}
	fi[0]=1;
	for(int i=1;i<maxn;i++){
		fi[i] = fi[i-1] * binpow(i,mod-2) % mod;
	}
	cin>>n;
	for(int i=1;i<n;i++){
		int u,v;cin>>u>>v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	dfs1(1,0);
	dfs2(1,0);
	//bug1(dp[1]);
	for(int i=1;i<=n;i++){
		cout << ans[i] << endl;
	}

}
/*
 * long long or int?
 * index out of bound? 
 * Tested on own test case?corner?
 * Make more general solution.
 * Read Read Read Read ....
 */


Measured memory_bytes: 24140