#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr long double EPS = 1e-8;

long long int N, M, K, L, R, H, W;
//int N, M, K, L, R, H, W;

void Calculate_Depth(vector<vector<int>>&edge, vector<int>&depth, int stnode) {
	depth[stnode] = 0;
	queue<int>Q;
	Q.push(stnode);
	while (!Q.empty()) {
		int cn = Q.front();
		Q.pop();
		for (auto i : edge[cn]) {
			if (depth[i] > depth[cn] + 1) {
				depth[i] = depth[cn] + 1;
				Q.push(i);
			}
		}
	}
	return;
}

long long int power(long long int x, long long int n, long long int M) {
	long long int ret = 1;
	long long int by = x;
	while (n) {
		if (n & 1) {
			ret *= by;
			ret %= M;
		}
		by *= by;
		by %= M;
		n >>= 1;
	}
	return ret;
}

void Search(vector<vector<int>>&edge, vector<int>&dis, vector<long long int>&sum, vector<long long int>&by, vector<long long int>&rev, vector<long long int>&dp, int node = 0) {
	for (auto i : edge[node]) {
		if (dis[i] < dis[node])continue;
		Search(edge, dis, sum, by, rev, dp, i);
		dp[node] *= dp[i];
		dp[node] %= MOD;
		dp[node] *= rev[sum[i]];
		dp[node] %= MOD;
		sum[node] += sum[i];
	}
	dp[node] *= by[sum[node] - 1];
	dp[node] %= MOD;
}

void Search(vector<vector<int>>&edge, vector<int>&dis, vector<long long int>&sum, vector<long long int>&dsum, vector<long long int>&by, vector<long long int>&rev, vector<long long int>&down, vector<long long int>&up, int node = 0) {
	for (auto i : edge[node]) {
		if (dis[i] < dis[node])continue;
		down[i] = down[node] * up[node] % MOD;
		down[i] *= rev[N - dsum[node]];
		down[i] %= MOD;
		down[i] *= by[N - dsum[i] + 1];
		down[i] %= MOD;
		down[i] *= power(up[i], MOD - 2, MOD);
		down[i] %= MOD;
		down[i] *= by[N - sum[i] - 1];
		down[i] %= MOD;
		down[i] *= rev[dsum[node] - 1];
		down[i] %= MOD;
		//down[i]*=
		Search(edge, dis, sum, dsum, by, rev, down, up, i);
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N;
	vector<vector<int>>edge(N);
	for (int i = 1; i < N; i++) {
		cin >> L >> R;
		L--, R--;
		edge[L].push_back(R);
		edge[R].push_back(L);
	}
	vector<int>dis(N, MOD);
	Calculate_Depth(edge, dis, 0);
	vector<long long int>up(N, 1);
	vector<long long int>by(N + 1, 1);
	vector<long long int>rev(N + 1, 1);
	vector<long long int>sum(N, 1);
	for (int i = 2; i <= N; i++) {
		by[i] = by[i - 1] * i;
		by[i] %= MOD;
		rev[i] = power(by[i], MOD - 2, MOD);
	}
	Search(edge, dis, sum, by, rev, up);
	vector<long long int>dsum(N, 1);
	vector<long long int>down(N, 1);
	for (int i = 0; i < N; i++) {
		dsum[i] = N - sum[i] + 1;
	}
	Search(edge, dis, sum, dsum, by, rev, down, up);
	for (int i = 0; i < N; i++) {
	//	cout << i << " " << up[i] << " " << down[i] << " " << endl;
				cout << up[i] * down[i] % MOD*by[N - 1] % MOD*rev[sum[i] - 1] % MOD*rev[dsum[i] - 1] % MOD << endl;
	}
}

Measured memory_bytes: 24948