#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1)
	{
		cerr << name << " = " << arg1 << 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 debug(...)
#endif

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ; ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

#define FAST_IO std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define pb push_back
#define mp make_pair
#define ld long double
#define sz(a) (ll)(a).size()
#define endl "\n"

// priority_queue<ll, vector<ll>, less<ll>>pq;     // Max Heap
// priority_queue<ll, vector<ll>, greater<ll>>pq;  // Min Heap

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//K-th smallest
//cout << k << "kth (1 based indexing) smallest: " << *A.find_by_order(k - 1) << endl;
//NO OF ELEMENTS < X
//cout << "No of elements less than " << X << " are " << A.order_of_key(X) << endl;

const int MAXN = 2e5 + 5;

vector<ll>adj[MAXN];
ll n, u, v, mod = 1e9 + 7, dp[MAXN], fact[MAXN], s[MAXN], ans[MAXN], f1[MAXN], f2[MAXN];

ll power(ll a, ll b)
{
	ll ans = 1;
	while(b > 0)
	{
		if(b & 1ll) ans = (ans * a) % mod;
		a = (a * a) % mod;
		b >>= 1ll;
	}
	return ans;
}

ll ssize(ll node, ll par)
{
	ll ss = 1;
	for(auto it : adj[node])
	{
		if(it == par) continue;
		ss += ssize(it, node);
	}
	return s[node] = ss;
}

void dfs(ll node, ll par)
{
	for(auto it : adj[node])
	{
		if(it == par) continue;
		dfs(it, node);
	}
	if(node && sz(adj[node]) == 1)
	{
		dp[node] = 1;
		return;	
	}
	ll temp = 1, temp1 = 1, temp2 = 0;
	for(auto it : adj[node])
	{
		if(it == par) continue;
		temp2 += s[it];
		temp1 = (temp1 * fact[s[it]]) % mod;
		temp = (temp * dp[it]) % mod; 
	}
	f1[node] = temp1;
	f2[node] = temp2;
	temp = (temp * fact[temp2]) % mod;
	temp = (temp * power(temp1, mod - 2)) % mod;
	dp[node] = temp;
}

void dfs2(ll node, ll par, ll curr)
{
	if(node)
	{
		ll zz = curr, temp1 = 1;
		for(auto it : adj[node])
		{
			if(it == par) continue;
			temp1 = (temp1 * fact[s[it]]) % mod;
			zz = (zz * dp[it]) % mod; 
		}
		temp1 = (temp1 * fact[n - s[node]]) % mod;
		zz = (zz * fact[n - 1]) % mod;
		zz = (zz * power(temp1, mod - 2)) % mod;
		ans[node] = zz;
	}
	for(auto it : adj[node])
	{
		if(it == par) continue;
		ll w = dp[node];
		w = (w * power(fact[s[node] - 1], mod - 2)) % mod;
		w = (w * fact[n - s[it] - 1]) % mod;
		w = (w * power(dp[it], mod - 2)) % mod;
		w = (w * curr) % mod;
		w = (w * fact[s[it]]) % mod;
		w = (w * power(fact[n - s[node]], mod - 2)) % mod;
		dfs2(it, node, w);
	}
}

int main()
{
	FAST_IO;

	fact[0] = 1;
	for(ll i=1;i<MAXN;i++) fact[i] = (fact[i - 1] * i) % mod;
 	cin >> n;
 	for(int i=0;i<n-1;i++)
 	{
 		cin >> u >> v;
 		adj[u - 1].pb(v - 1);
 		adj[v - 1].pb(u - 1);
 	}  
 	ssize(0, -1);
 	dfs(0, -1);
 	ans[0] = dp[0];
 	dfs2(0, -1, 1);
 	for(int i=0;i<n;i++) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 23680