#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<random>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include <queue>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldb = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney, tree, chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun

#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define PRI(s) cout << s << endl
#define PRIF(v, n) printf("%."#n"f\n", v)
#define PRIY PRI("Yes")
#define PRIN PRI("No")
#define MINS(a,b) a = min(a,(decltype(a))(b))
#define MAXS(a,b) a = max(a,(decltype(a))(b))

//拡張ユークリッドの互除法。戻り値は最大公約数、x,yはax+by=gcd(a,b)を満たす組の一つ
long long gcdext(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long g = gcdext(b, a % b, y, x);
	y -= a / b * x;
	return g;
}

//モジュラ逆数
long long modinv(long long a, long long mod) {
	long long x, y;
	gcdext(a, mod, x, y);
	x = ((x % mod) + mod) % mod;
	return x;
}

struct node {
	int id;
	vector<int> link;
};

struct edge {
	int l[2];
};

vector<node> nod;
vector<edge> ed;
vector<ll> frac;
vector<unordered_map<ll, ll>> dpn;
vector<unordered_map<ll, ll>> dpv;
ll N;
ll mod = 1e9 + 7;

int nxt(int node_idx, int edge_idx) {
	if (ed[edge_idx].l[0] == node_idx)return ed[edge_idx].l[1];
	else return ed[edge_idx].l[0];
}

void rundpn_sub(int ind, int par) {
	ll cnt = 1;
	for (int e : nod[ind].link) {
		int c = nxt(ind, e);
		if (c == par)continue;
		if (dpn[c].count(ind) == 0)	rundpn_sub(c, ind);
		cnt += dpn[c][ind];
	}
	dpn[ind][par] = cnt;
}

void rundpn_sub2(int ind, int par) {
	ll cnt = 1;
	for (int e : nod[ind].link) {
		int c = nxt(ind, e);
		cnt += dpn[c][ind];
	}
	dpn[ind][-1] = cnt;
	for (int e : nod[ind].link) {
		int c = nxt(ind, e);
		dpn[ind][c] = dpn[ind][-1] - dpn[c][ind];
	}
	for (int e : nod[ind].link) {
		int c = nxt(ind, e);
		if (c != par) rundpn_sub2(c, ind);
	}
}

void rundpn() {
	rundpn_sub(0, -1);
	for (int e : nod[0].link) {
		int c = nxt(0, e);
		dpn[0][c] = dpn[0][-1] - dpn[c][0];
	}
	for (int e : nod[0].link) {
		int c = nxt(0, e);
		rundpn_sub2(c, 0);
	}
}

void rundpv_sub(int ind, int par) {
	ll tmp = frac[dpn[ind][par] - 1];
	for (int e : nod[ind].link) {
		int c = nxt(ind, e);
		if (c == par) continue;
		if (dpv[c].count(ind) == 0) rundpv_sub(c, ind);
		tmp = tmp * modinv(frac[dpn[c][ind]], mod) % mod;
		tmp = tmp * dpv[c][ind] % mod;
	}
	dpv[ind][par] = tmp;
}

void rundpv_sub2(int ind, int par) {
	ll tmp = frac[dpn[ind][-1] - 1];
	for (int e : nod[ind].link) {
		int c = nxt(ind, e);
		tmp = tmp * dpv[c][ind] % mod;
		tmp = tmp * modinv(frac[dpn[c][ind]], mod) % mod;
	}
	dpv[ind][-1] = tmp;
	for (int e : nod[ind].link) {
		int c = nxt(ind, e);
		ll a = dpv[ind][-1] * modinv(frac[dpn[ind][-1] - 1], mod) % mod * frac[dpn[ind][c] - 1] % mod;
		a = a * frac[dpn[c][ind]] % mod;
		a = a * modinv(dpv[c][ind],mod) % mod;
		dpv[ind][c] = a;
	}
	for (int e : nod[ind].link) {
		int c = nxt(ind, e);
		if (c != par) rundpv_sub2(c, ind);
	}
}

void rundpv() {
	rundpv_sub(0, -1);
	for (int e : nod[0].link) {
		int c = nxt(0, e);
		dpv[0][c] = dpv[0][-1] * modinv(frac[dpn[0][-1] - 1], mod) % mod * frac[dpn[0][c] - 1] % mod * frac[dpn[c][0]] % mod * modinv(dpv[c][0], mod) % mod;
	}
	for (int e : nod[0].link) {
		int c = nxt(0, e);
		rundpv_sub2(c, 0);
	}
}

int main() {
	frac.resize(200001);
	frac[0] = 1;
	REP(i, 1, 200000 + 1) {
		frac[i] = frac[i - 1] * i % mod;
	}
	cin >> N;
	nod.resize(N);
	ed.resize(N - 1);
	dpn.resize(N);
	dpv.resize(N);
	REP(i, 0, N - 1) {
		ll a, b;
		cin >> a >> b;
		--a; --b;
		ed[i].l[0] = a;
		ed[i].l[1] = b;
		nod[a].link.push_back(i);
		nod[b].link.push_back(i);
	}
	rundpn();
	rundpv();
	REP(i, 0, N)PRI(dpv[i][-1]);
	return 0;
}

Measured memory_bytes: 95388