#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 1000000007

using namespace std;
typedef pair<llint, llint> P;

const int FACT_MAX = 400005;
llint fact[FACT_MAX], fact_inv[FACT_MAX];

llint modpow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%mod) * (modpow(a, n-1)%mod)) % mod;
	}
	else{
		return modpow((a*a)%mod, n/2) % mod;
	}
}

void make_fact()
{
	llint val = 1;
	fact[0] = 1;
	for(int i = 1; i < FACT_MAX; i++){
		val *= i;
		val %= mod;
		fact[i] = val;
	}
	fact_inv[FACT_MAX-1] = modpow(fact[FACT_MAX-1], mod-2);
	for(int i = FACT_MAX-2; i >= 0; i--){
		fact_inv[i] = fact_inv[i+1] * (i+1) % mod;
	}
}

llint comb(llint n, llint k)
{
	llint ret = 1;
	ret *= fact[n];
	ret *= fact_inv[k], ret %= mod;
	ret *= fact_inv[n-k], ret %= mod;
	return ret;
}

llint n;
vector<llint> G[200005];
map<P, llint> mp;
map<P, llint> mp2;

void dfs(int v, int p)
{
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == p) continue;
		dfs(G[v][i], v);
	}
	
	llint sum = 0, mul = 1;
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == p) continue;
		llint num = mp2[P(v, G[v][i])];
		sum += num;
		mul *= mp[P(v, G[v][i])] * fact_inv[num] % mod, mul %= mod;
	}
	mp[P(p, v)] = mul * fact[sum] % mod;
	mp2[P(p, v)] = sum + 1;
}

llint lmul[200005], rmul[200005];
llint lsum[200005], rsum[200005];
void dfs2(int v, int p)
{
	llint m = G[v].size();
	
	llint mul = 1; lmul[0] = 1;
	llint sum = 0; lsum[0] = 0;
	for(int i = 0; i < G[v].size(); i++){
		int u = G[v][i];
		llint num = mp2[P(v, u)];
		sum += num;
		mul *= mp[P(v, u)] * fact_inv[num] % mod, mul %= mod;
		lsum[i+1] = sum;
		lmul[i+1] = mul;
	}
	
	mul = 1; rmul[m+1] = 1;
	sum = 0; rsum[m+1] = 0;
	for(int i = (int)G[v].size()-1; i >= 0; i--){
		int u = G[v][i];
		
		llint num = mp2[P(v, u)];
		sum += num;
		mul *= mp[P(v, u)] * fact_inv[num] % mod, mul %= mod;
		rsum[i+1] = sum;
		rmul[i+1] = mul;
	}
	
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == p) continue;
		int u = G[v][i];
		llint sum = mp2[P(u, v)] = lsum[i] + rsum[i+2] + 1;
		mp[P(u, v)] = lmul[i] * rmul[i+2] % mod * fact[sum-1] % mod;
	}
	
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == p) continue;
		dfs2(G[v][i], v);
	}
}


int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	make_fact();
	
	cin >> n;
	llint u, v;
	for(int i = 1; i <= n-1; i++){
		cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	dfs(1, -1);
	dfs2(1, -1);
	
	/*for(auto it = mp.begin(); it != mp.end(); it++){
		cout << it->first.first << " " << it->first.second << " " << it->second << endl;
	}*/
	
	for(int i = 1; i <= n; i++){
		llint mul = 1, sum = 0;
		for(int j = 0; j < G[i].size(); j++){
			int u = G[i][j];
			llint num = mp2[P(i, u)];
			sum += num;
			mul *= mp[P(i, u)] * fact_inv[num] % mod, mul %= mod;
		}
		mul *= fact[sum], mul %= mod;
		cout << mul << "\n";
	}
	flush(cout);
	
	return 0;
}

Measured memory_bytes: 77316