#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod = 1000000007;
int rnd(int x) { return mrand() % x; }
ll powmod(ll a, ll b) { ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a % mod; a = a * a % mod; }return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
// head

static uint MD = mod;
struct ModInt {
	using M = ModInt;
	uint v;
	ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
	M& set_v(uint _v)
	{
		v = (_v < MD) ? _v : _v - MD;
		return *this;
	}
	explicit operator bool() const { return v != 0; }
	M operator-() const { return M() - *this; }
	M operator+(const M& r) const { return M().set_v(v + r.v); }
	M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
	M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
	M operator/(const M& r) const { return *this * r.inv(); }
	M& operator+=(const M& r) { return *this = *this + r; }
	M& operator-=(const M& r) { return *this = *this - r; }
	M& operator*=(const M& r) { return *this = *this * r; }
	M& operator/=(const M& r) { return *this = *this / r; }
	bool operator==(const M& r) const { return v == r.v; }
	M pow(ll n) const
	{
		M x = *this, r = 1;
		while (n) {
			if (n & 1) r *= x;
			x *= x;
			n >>= 1;
		}
		return r;
	}
	M inv() const { return pow(MD - 2); }
	friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt;

const int MAXN = 200000 + 5;

vector<vi> G;
vi sonnumup;
vi sonnumdown;
vector<Mint> dpup;
vector<Mint> dpdown;
Mint fac[MAXN];

void calcFac() {
	fac[0] = fac[1] = 1;
	rep(i, 2, MAXN) fac[i] = fac[i - 1] * i;
}

void dfsdown(int from, int par) {
	if (sz(G[from]) == 1 && G[from][0]==par) {//leaf
		sonnumdown[from] = 1;
		dpdown[from] = 1;
		return;
	}
	int sonnum = 0;
	for (int to : G[from]) {
		if (to != par) {
			dfsdown(to, from);
			sonnum += sonnumdown[to];
		}
	}
	Mint ans = fac[sonnum];
	for (int to : G[from]) {
		if (to != par) {
			ans *= dpdown[to] / fac[sonnumdown[to]];
		}
	}
	dpdown[from] = ans;
	sonnumdown[from] = sonnum+1;
}

Mint getDpup(int par, int son, int nsn) {
	int a = nsn + sonnumdown[son]-1;
	Mint b = fac[a] / fac[nsn-1];
	Mint c = dpup[par]/(b*dpdown[son])*fac[sonnumdown[son]];
	return c;
}

void dfsup(int from, int par, int nsn) {
	if (par != -1) {
		Mint a = getDpup(par, from, nsn);
		dpup[from] = dpdown[from];
		int b = nsn + sonnumdown[from] - 1;
		dpup[from] *= fac[b] / fac[sonnumdown[from] - 1] * a / fac[nsn];
	}
	else {
		dpup[from] = dpdown[from];
	}
	for (int to : G[from]) {
		if (to != par) {
			dfsup(to, from, nsn+ sonnumdown[from] - sonnumdown[to]);
		}
	}
}

int main()
{
	ios::sync_with_stdio(false);
#ifdef RG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	calcFac();
	
	int n;
	cin >> n;
	int a, b;
	G.resize(n, vi());
	rep(i, 0, n - 1) {
		cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	sonnumup.resize(n, 0);
	sonnumdown.resize(n, 0);
	dpup.resize(n, 0);
	dpdown.resize(n, 0);

	dfsdown(0, -1);
	dfsup(0, -1, 0);

	//rep(i, 0, n) cout << sonnumdown[i] << endl;
	//rep(i, 0, n) cout << dpdown[i]<<","<< dpup[i] << endl;
	rep(i, 0, n) cout << dpup[i] << endl;
	return 0;
}

Measured memory_bytes: 17908