/* ****revpro**** */
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl	   '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii	    map<ll,ll>
using namespace std;

#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define N  200005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update> 
ll add(ll x,ll y,ll mod=hell) { x += y; if(x >= mod) x -= mod; return x;}
ll sub(ll x,ll y,ll mod=hell) { x -= y; if(x < 0) x += mod; return x;}
ll mul(ll x,ll y,ll mod=hell) { return (x * 1ll * y) % mod;}
ll expo(ll base, ll exponent, ll mod=hell) {								//return base^exponent modulo modulus
    ll ans = 1;
    while(exponent !=0 ) {
        if((exponent&1) == 1) {
            ans = ans*base ;
            ans = ans%mod;
        }
        base = base*base;
        base %= mod;
        exponent>>= 1;
    }
    return ans%mod;
}
vi a[N];
ll subt[N];
ll vis[N];
ll ans[N];
ll fac[N];
ll n;
void dfs(ll node)
{
	vi v;
	ll s=0;
	vis[node]=1;
	subt[node]=1;
	ans[node]=1;
	for(auto i:a[node])
	if(!vis[i])
	{
		dfs(i);
		subt[node]+=subt[i];
		ans[node]=mul(ans[node],ans[i]);
		v.pb(subt[i]);
	}
	for(auto i:v)
		ans[node]=mul(ans[node],expo(fac[i],hell-2));
	ans[node]=mul(ans[node],fac[subt[node]-1]);
}
ll res[N];
void dfs(ll node,ll ansp,ll p)
{
	vis[node]=1;
	for(auto i:a[node])
	{
		if(i!=p)
			ansp=mul(ansp,mul(ans[i],expo(fac[subt[i]],hell-2)));
	}
	ansp=mul(ansp,expo(fac[n-subt[node]],hell-2));
	ansp=mul(ansp,fac[n-1]);
	res[node]=ansp;
	for(auto i:a[node]){
		if(i!=p)
		{
			ansp=mul(ansp,mul(expo(ans[i],hell-2),fac[subt[i]]));
			ansp=mul(ansp,expo(fac[n-1],hell-2));
			ansp=mul(ansp,fac[n-1-subt[i]]);
			dfs(i,ansp,node);
			ansp=mul(ansp,mul(expo(fac[subt[i]],hell-2),ans[i]));
			ansp=mul(ansp,fac[n-1]);
			ansp=mul(ansp,expo(fac[n-1-subt[i]],hell-2));
		}
	}
}
void solve()
{
	cin>>n;
	fac[0]=1;
	rep(i,1,n) fac[i]=mul(fac[i-1],i);
	for(int i=0;i<n-1;i++){
		ll x,y;
		cin>>x>>y;
		a[x].pb(y);
		a[y].pb(x);	
	}
	dfs(1);
	// rep(i,1,n+1) cout<<subt[i]<<' ';
	// cout<<endl;
	// rep(i,1,n+1) cout<<ans[i]<<' ';
	// cout<<endl; 
	rep(i,1,n+1) vis[i]=0;
	dfs(1,1,0);
	rep(i,1,n+1) cout<<res[i]<<'\n';
}
signed main()
{
	
		/***********************************/
    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
    mt19937_64 generator (seed);
    /***********************************/
 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		solve();
		
	}
	TIME
	return 0;
}

Measured memory_bytes: 22612