#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
//#define PB emplace_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'

const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

//
//debug
template<typename F,typename S>ostream&operator<<(ostream&os,const pair<F,S>&p){return os<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&v){os<<"{";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<", ";os<<*it;}return os<<"}";}
template<typename T>ostream&operator<<(ostream&os,const set<T>&v){os<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<",";os<<*it;}return os<<"]";}
template<typename T>ostream&operator<<(ostream&os,const multiset<T>&v) {os<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<", ";os<<*it;}return os<<"]";}
template<typename F,typename S>ostream&operator<<(ostream&os,const map<F,S>&v){os<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<", ";os<<it->first<<" = "<<it->second;}return os<<"]";}
#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu(){cerr << endl;}
template<typename T>void faltu(T a[],int n){for(int i=0;i<n;++i)cerr<<a[i]<<' ';cerr<<endl;}
template<typename T,typename...hello>void faltu(T arg,const hello&...rest){cerr<<arg<<' ';faltu(rest...);}
//#else
//#define dbg(args...)

const int mx = 2e5+5;
int N;
vi adjlist[mx];
ll dp[mx];
ll ans[mx];
ll sub[mx];

ll fact[mx];
ll fact_inv[mx];

ll inv[mx];

void generate_modinv()
{
	inv[1] = 1;
	for( int i = 2; i < mx; i++ ) {
		inv[i] = (-(MOD/i) * inv[MOD%i] ) % MOD;
		inv[i] = inv[i] + MOD;
	}
}

ll expo( ll b, ll p, ll m ) {
    ll res = 1LL, x = b%m;
    while(p) {
        if ( p&1LL ) res = ( res*x ) % m;
        x = ( x*x ) % m;
        p >>= 1LL;
    }
    return res;
}

void dfs1( int u, int par )
{
	dp[u] = 1;
	sub[u] = 1;
	for( auto v : adjlist[u] ) {
		if( v == par ) continue;
		dfs1( v, u );
		sub[u] += sub[v];
		dp[u] *= dp[v];
		dp[u] %= MOD;
		dp[u] *= fact_inv[sub[v]];
		dp[u] %= MOD;
	}
	dp[u] *= fact[sub[u]-1];
	dp[u] %= MOD;
}

void dfs2( int u, int par, ll up_dp )
{
	ll temp_up_dp = up_dp;
	for( auto v : adjlist[u] ) {
		if( v == par ) continue;
		temp_up_dp *= dp[v];
		temp_up_dp %= MOD;
		//temp_up_dp *= fact_inv[sub[v]];
		temp_up_dp *= expo( fact[sub[v]], MOD-2, MOD );
		temp_up_dp %= MOD;
	}
	ll fix_up_dp = temp_up_dp;
	for( auto v : adjlist[u] ) {
		if( v == par ) continue;
		temp_up_dp = fix_up_dp;
		temp_up_dp *= expo( dp[v], MOD-2, MOD );
		temp_up_dp %= MOD;
		temp_up_dp *= fact[sub[v]];
		temp_up_dp %= MOD;

		temp_up_dp *= expo( fact[N-sub[u]], MOD-2, MOD );
		//dbg(u,expo( fact[N-sub[u]], MOD-2, MOD ) );
		temp_up_dp %= MOD;
		temp_up_dp *= fact[N-sub[v]-1];
		temp_up_dp %= MOD;

		ll temp_ul = temp_up_dp;

		ll ret = dp[v];
		//ret *= fact_inv[sub[v]-1];
		ret *= expo( fact[sub[v]-1], MOD-2, MOD );
		ret %= MOD;

		//dbg(u, temp_up_dp, ret);

		temp_up_dp *= ret;
		temp_up_dp %= MOD;
		temp_up_dp *= fact[N-1];
		temp_up_dp %= MOD;
		temp_up_dp *= fact_inv[N-sub[v]];
		temp_up_dp %= MOD;
		ans[v] = temp_up_dp;

		dfs2( v, u, temp_ul );

	}
}

int main()
{
	optimize();
	fact[0] = 1;
	generate_modinv();
	fact_inv[0] = 1;
	for( int i = 1; i < mx; ++i ) {
		fact_inv[i] = inv[i]*fact_inv[i-1];
		fact_inv[i] %= MOD;
	}
	for( int i = 1; i < mx; ++i ) {
		fact[i] = fact[i-1]*i;
		fact[i] %= MOD;
	}
	cin >> N;
	for( int i = 0; i < N-1; ++i ) {
		int u, v;
		cin >> u >> v;
		adjlist[u].PB(v);
		adjlist[v].PB(u);
	}
	dfs1(1, 0);
	ans[1] = dp[1];
	dfs2(1, 0, 1);
	for( int i = 1; i <= N; ++i ) cout << ans[i] << endl;
}























Measured memory_bytes: 23284