#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1000000007;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
//typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;

//拡張拡張Euclidの互除法による(階乗)逆元の求め方
//O(N)
void stairs(long long N, vector<long long>& st, long long mod = 1e9 + 7) {
	st.resize(N + 1, 1);
	for (long long n = 2; n <= N; n++) {
		st[n] = (st[n - 1] * n) % mod;
	}
}

void modinvs(long long N, vector<long long>& inv, vector<long long>& sinv, long long mod = 1e9 + 7) {
	inv.resize(N + 1);
	sinv.resize(N + 1);
	inv[1] = 1;
	sinv[0] = 1;
	sinv[1] = 1;
	for (int n = 2; n <= N; n++) {
		inv[n] = mod - (inv[mod % n] * (mod / n)) % mod;
		sinv[n] = (sinv[n - 1] * inv[n]) % mod;
	}
}

//(n^(-1),(n!)^(-1))
PLL modinvs(LL N, LL mod = 1e9 + 7) {
	vector<LL> inv(N + 1);
	inv[1] = 1;
	LL sinv = 1;
	for (int n = 2; n <= N; n++) {
		inv[n] = mod - (inv[mod % n] * (mod / n)) % mod;
		sinv = (sinv * inv[n]) % mod;
	}
	return PLL(inv[N], sinv);
}

VVLL G;
LL N;

VVLL childs;
VLL parent;
VLL subtree;

VLL DP1, DP2;

VLL stair, inv, sinv;

void setTree() {
	childs.resize(N);
	parent.resize(N,-1);
	queue<PLL> q;
	q.push(PLL(0, -1));
	while (!q.empty()) {
		LL cur = q.front().first;
		LL par = q.front().second;
		q.pop();
		parent[cur] = par;
		for (LL ch : G[cur]) {
			if (ch == par)continue;
			childs[cur].push_back(ch);
			q.push(PLL(ch, cur));
		}
	}
}

void dp1(LL n) {
	if (childs[n].size() == 0) {
		subtree[n] = 1;
		DP1[n] = 1;
		return;
	}
	subtree[n] = 0;
	for (LL ch : childs[n]) {
		dp1(ch);
		subtree[n] += subtree[ch];
	}
	VLL& chs = childs[n];
	VLL left(chs.size());
	for (LL c = 0; c < chs.size(); c++) {
		left[c] = (DP1[chs[c]] * sinv[subtree[chs[c]]]) % MOD;
	}
	for (LL c = 1; c < chs.size(); c++) {
		left[c] = (left[c] * left[c - 1]) % MOD;
	}
	DP1[n] = (stair[subtree[n]] * left.back()) % MOD;
	subtree[n]++;
}

void dp2(LL n) {
	VLL& chs = childs[n];
	VLL left(chs.size()), right(chs.size());
	for (LL c = 0; c < chs.size(); c++) {
		left[c] = (DP1[chs[c]] * sinv[subtree[chs[c]]]) % MOD;
		right[c] = left[c];
	}
	for (LL c = 1; c < chs.size(); c++) {
		left[c] = (left[c] * left[c - 1]) % MOD;
	}
	for (LL c = (LL)chs.size() - 2; c >= 0; c--) {
		right[c] = (right[c] * right[c + 1]) % MOD;
	}
	for (LL c = 0; c < chs.size(); c++) {
		LL v = chs[c];
		LL s = N - subtree[v] - 1;
		DP2[v] = stair[s];
		if (c > 0)DP2[v] = (DP2[v] * left[c - 1]) % MOD;
		if (c < chs.size() - 1)DP2[v] = (DP2[v] * right[c + 1]) % MOD;
		DP2[v] = (DP2[v] * DP2[n]) % MOD;
		DP2[v] = (DP2[v] * sinv[N - subtree[n]]) % MOD;
	}
	for (LL ch : childs[n]) {
		dp2(ch);
	}
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	cin >> N;
	G.resize(N);
	for (LL n = 0; n < N - 1; n++) {
		LL u, v;
		cin >> u >> v;
		v--; u--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	setTree();
	stairs(N, stair, MOD);
	modinvs(N, inv, sinv, MOD);
	DP1.resize(N,-1);
	DP2.resize(N, 1);
	subtree.resize(N);
	dp1(0);
	dp2(0);
	for (LL n = 0; n < N; n++) {
		LL temp = stair[N-1];
		for (LL ch : childs[n]) {
			temp = (temp * sinv[subtree[ch]]) % MOD;
			temp = (temp * DP1[ch]) % MOD;
		}
		temp = (temp * sinv[N - subtree[n]]) % MOD;
		temp = (temp * DP2[n]) % MOD;
		cout << temp << "\n";
	}
	return 0;
}

Measured memory_bytes: 34176