#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>
#include <functional>
#include <bitset>

using namespace std;

typedef pair<long long int, long long int> P;
typedef pair<long long int, P> P2;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

// 全方位木DPを処理するクラス (0-indexed)
template <class T> class ReRooting {
public:
	int nodeCount;

private:
	vector<vector<int>> E, idForAdjacentNode;
	//idForAdjacentNode[i][j] := E[i][j](iのj番目の隣接頂点)にとって、iが何番目の隣接頂点か
	//                           つまり、 E[ E[i][j] ][ idForAdjacentNode[i][j] ] == i である
	vector<vector<T>> DP; // 辺から先の情報
	function<T(T, T)> operate; // 辺から先の情報(DP)を結合する際の操作
	T identity; // 上記の Operate における零元
	function<T(T, int)> operateNode; // 各頂点で最後に行う操作

public:
	// コンストラクタ
	ReRooting(int nodeCount_, vector<P> edges,
		function<T(T, T)> operate_, T identity_,
		function<T(T, int)> operateNode_) {
        nodeCount = nodeCount_;

        identity = identity_;
        operate = operate_;
        operateNode = operateNode_;

		E = vector<vector<int>>(nodeCount);
		idForAdjacentNode = vector<vector<int>>(nodeCount);

		for(P edge : edges){
			int u = edge.first, v = edge.second;
			idForAdjacentNode[u].push_back(E[v].size());
			idForAdjacentNode[v].push_back(E[u].size());
			E[u].push_back(v);
			E[v].push_back(u);
		}

		DP = vector<vector<T>>(nodeCount);
		for(int i = 0; i < nodeCount; i++){
			DP[i] = vector<T>(E[i].size());
		}

		func1(-1, 0);
		func2(-1, 0);
	}

	// 各頂点に隣接する辺の情報(DP)を返す
	vector<T> query(int node) {
		return DP[node];
	}

private:
	T func1(int from, int pos) {
		T res = identity;
		for(int i = 0; i < E[pos].size(); i++){
			int to = E[pos][i];
			if(from != to){
				DP[pos][i] = func1(pos, to);
				res = operate(res, DP[pos][i]);
			}
		}
		return operateNode(res, pos);
	}

	T func2(int from, int pos) {
		vector<T> accums1(E[pos].size());
		accums1[0] = identity;
		for(int i = 1; i < E[pos].size(); i++){
			accums1[i] = operate(accums1[i - 1], DP[pos][i - 1]);
		}
		T accums2 = identity;
		for(int i = E[pos].size() - 1; i >= 0; i--){
			int to = E[pos][i];
			DP[to][idForAdjacentNode[pos][i]] = operateNode(operate(accums1[i], accums2), pos);
			if(from != to){
				func2(pos, to);
			}
			accums2 = operate(accums2, DP[pos][i]);
		}
	}
};

long long int fact[210000], factm[210000];

long long int rev_mod(long long int num){
	long long int pow_num = MOD - 2;
	long long int mod_num = MOD;
	long long int pow_cur = num;
	long long int ret = 1;
	while(pow_num > 0){
		if(pow_num % 2 == 1){
			ret *= pow_cur;
			ret %= mod_num;
		}
		pow_cur *= pow_cur;
		pow_cur %= mod_num;
		pow_num /= 2;
	}
	return ret;
}

P operate(P DP1, P DP2){
	long long int ret = DP1.second * DP2.second % MOD;
	ret *= fact[DP1.first + DP2.first];
	ret %= MOD;
	ret *= factm[DP1.first];
	ret %= MOD;
	ret *= factm[DP2.first];
	ret %= MOD;
	return P(DP1.first + DP2.first, ret);
}

P operateNode(P DP1, int pos){
	return P(DP1.first + 1, DP1.second);
}

int main(){
	int N;
	cin >> N;
	fact[0] = factm[0] = 1;
	for(int i = 1; i <= N; i++){
		fact[i] = fact[i - 1] * i % MOD;
		factm[i] = factm[i - 1] * rev_mod(i) % MOD;
	}
	vector<P> edges;
	for(int i = 0; i < N - 1; i++){
		P e;
		cin >> e.first >> e.second;
		e.first -= 1;
		e.second -= 1;
		edges.push_back(e);
	}
	ReRooting<P> rerooting(N, edges, operate, P(0, 1), operateNode);
	for(int i = 0; i < N; i++){
		vector<P> DP = rerooting.query(i);
		P ans = P(0, 1);
		for(P dp : DP){
			ans = operate(ans, dp);
		}
		cout << ans.second << endl;
	}
	return 0;
}


Measured memory_bytes: 51180