#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os << "[ "; 
	for(auto v:V)os << v << " "; return os << "]";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){ os << "{ "; 
	for(auto s:S) os<<s<<" ";  return os<<"}"; 
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
	return os<<"("<<P.first<<","<< P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
	os<<"{ ";for(auto m:M)os<<"("<<m.F<<":"<<m.S<<")";
	return os<<"}";
}
#define cerr cout
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define I insert 
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define For(i,n) for(int i=0;i<(int)n;++i)
#define Rev(i,n) for(int i=(int)n-1;i>=0;--i)
#define Rep(i,n) for(int i=1;i<=(int)n;++i)
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpii;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

const int N = 2e5 + 100;
const int mod = 1e9 + 7;
vi G[N];
int add(int a , int b){
	a += b;
	if(a >= mod)a -= mod;
	return a;
}
int mul(int a, int b){
	return a*1ll*b%mod;
}
int power(int x , int y){
	int res = 1;
	while(y){
		if(y&1)
			res = mul(res , x);
		x = mul(x , x);
		y >>= 1;
	}
	return res;
}
int A[N] , dp[N] , fac[N] , inv[N] , siz[N];
void pre(){
	fac[0] = 1;
	inv[0] = 1;
	for(int i = 1;i < N ; ++i){
		fac[i] = mul(i , fac[i-1]);
	}
	inv[N-1] = power(fac[N-1] , mod-2);
	for(int i = N-2 ;i >= 0 ; --i){
		inv[i] = mul(inv[i+1] , (i+1));
	}
	assert(inv[0] == 1);
}
//only constainst is number on the root is smaller than 
void dfs(int s , int p){
	siz[s] = 1;
	int ans = 1;
	for(auto it : G[s]){
		if(it == p) continue;
		dfs(it , s);
		siz[s] += siz[it];
		ans = mul(ans , inv[siz[it]]);
		ans = mul(ans , dp[it]);
	}
	ans = mul(ans , fac[siz[s]-1]); //for number on the root to be smaller
	dp[s] = ans;
}
void dfs2(int s , int p){
	A[s] = dp[s];
	for(auto it : G[s]){
		if(it == p) continue;
		int tmp_dp_s = dp[s];
		int tmp_dp_it = dp[it];
		int tmp_siz_s = siz[s];
		int tmp_siz_it = siz[it];
		dp[s] = mul(dp[s] , power(dp[it] , mod-2));
		dp[s] = mul(dp[s] , fac[siz[it]]);
		dp[s] = mul(dp[s] , inv[siz[s]-1]);
		dp[it] = mul(dp[it] , inv[siz[it]-1]);
		siz[s] -= siz[it];
		siz[it] += siz[s];
		dp[s] = mul(dp[s] , fac[siz[s]-1]);
		dp[it] = mul(dp[it] , dp[s]);
		dp[it]	= mul(dp[it] , fac[siz[it]-1]);
		dp[it] = mul(dp[it] , inv[siz[s]]);
		dfs2(it , s);
		dp[s] = tmp_dp_s;
		dp[it] = tmp_dp_it;
		siz[s] = tmp_siz_s;
		siz[it] = tmp_siz_it;
	}
}



int main(){
	fio; cout<<fixed<<setprecision(25);	
	pre();
	int n; cin >> n;
	int u , v;
	for(int i = 0;i < n-1 ; ++i){
		cin >> u >> v;
		G[u].pb(v);
		G[v].pb(u);
	}
	dfs(1 , -1);
	dfs2(1 , -1);
	for(int i =1 ;i <= n ; ++i){
		cout << A[i] << endl;
	}




	return 0;
}











Measured memory_bytes: 17908