#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

ll mod = 1000000007;
ll modsize = 1000010;

ll modinv(ll a) {
	ll b = mod, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}

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

vector<ll> fac(modsize + 5);
vector<ll> inv(modsize + 5);
vector<ll> facinv(modsize + 5);

void modcalc() {
	fac[0] = fac[1] = 1; inv[1] = 1;
	facinv[0] = facinv[1] = 1;
	for (int i = 2; i < modsize; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		facinv[i] = facinv[i - 1] * inv[i] % mod;
	}
}

ll modcomb(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[k] % mod * facinv[n - k] % mod;
}

ll modperm(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[n - k] % mod;
}

ll modhom(ll n, ll k) {
	if (n < 0 || k < 0) return 0;
	if (n == 0 && k == 0) return 1;
	return modcomb(n + k - 1, k);
}

vector<vector<int>> graph(200010, vector<int>());
vector<P> memo(200010);
vector<int> ans(200010);

P dfs(int n, int prev) {
	int res = 1, cnt = 0;
	for (int i : graph[n]) {
		if (i == prev) continue;
		P p = dfs(i, n);
		int px = p.first; int py = p.second;
		res *= px; res %= mod;
		res *= modcomb(cnt + py, cnt); res %= mod;
		cnt += py; 
	}
	cnt++;
	if (n == 0) ans[n] = res;
	return memo[n] = P(res, cnt);
}

void dfs2(int n, int prev, P pres) {
	for (int i : graph[n]) {
		if (i == prev) continue;
		int px = pres.first; int py = pres.second;
		px *= modinv(memo[i].first); px %= mod;
		px *= modinv(modcomb(py - 1, memo[i].second)); px %= mod;
		py -= memo[i].second;
		int res = 1, cnt = 0;
		for (int j : graph[i]) {
			if (j == n) {
				res *= px; res %= mod;
				res *= modcomb(cnt + py, cnt); res %= mod;
				cnt += py;
			}
			else {
				res *= memo[j].first; res %= mod;
				res *= modcomb(cnt + memo[j].second, cnt); res %= mod;
				cnt += memo[j].second;
			}
		}
		ans[i] = res;
		dfs2(i, n, P(res, cnt + 1));
	}
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	modcalc();

	int n;
	cin >> n;
	rep(i, n - 1) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		graph[a].pb(b);
		graph[b].pb(a);
	}
	P p = dfs(0, -1);
	dfs2(0, -1, p);
	rep(i, n) cout << ans[i] << endl;
}

Measured memory_bytes: 42864