#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#include <sstream>
#include <bitset>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
ll poww(ll a, ll b) { if (a == 0ll) {return 0ll;} ll ans = 1; while (b) {if (b & 1) {ans = ans * a ;} a = a * a ; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
const ll mod = 1e9 + 7;
ll fac[maxn], inv[maxn];
void pre()
{
	fac[0] = 1;
	for (int i = 1; i < maxn; i++) fac[i] = fac[i - 1] * i % mod;
	inv[maxn - 1] = powmod(fac[maxn - 1], mod - 2, mod);
	for (int i = maxn - 2; i >= 0; i--) inv[i] = inv[i + 1] * (i + 1) % mod;
}
ll C(int a, int b)
{
	if (b > a || b < 0) return 0;
	return fac[a] * inv[b] % mod * inv[a - b] % mod;
}
int n;
std::vector<int> son[maxn];
int son_cnt[maxn];
ll dp[maxn];
void build()
{
	n = readint();
	int u, v;
	repd(i, 1, n - 1)
	{
		u = readint();
		v = readint();
		son[u].pb(v);
		son[v].pb(u);
	}
}
void dfs1(int x, int pre)
{
	son_cnt[x] = 1;
	for (auto &y : son[x])
	{
		if (y != pre)
		{
			dfs1(y, x);
			son_cnt[x] += son_cnt[y];
		}
	}
	dp[x] = 1ll;
	ll cnt = 1ll;
	for (auto &y : son[x])
	{
		if (y != pre)
		{
			dp[x] = dp[x] * C(son_cnt[x] - cnt, son_cnt[y]) % mod * dp[y] % mod;
			cnt += son_cnt[y];
		}
	}
}
void dfs2(int x, int pre)
{
	for (auto &y : son[x])
	{
		if (y != pre)
		{
			ll temp = dp[x] * powmod(C(n - 1, son_cnt[y]), mod - 2ll, mod) % mod * powmod(dp[y], mod - 2ll, mod) % mod;
			dp[y] = dp[y] * C(n - 1, n - son_cnt[y]) % mod * temp % mod;
			dfs2(y, x);
		}
	}
}

#define DEBUG_Switch 0
int main()
{
#if DEBUG_Switch
	freopen("C:\\code\\input.txt", "r", stdin);
#endif
	//freopen("C:\\code\\output.txt","r",stdin);
	pre();
	build();
	dfs1(1, 0);
	dfs2(1, 0);
	repd(i, 1, n)
	{
		printf("%lld\n", dp[i] );
	}
	return 0;
}




Measured memory_bytes: 55412