#include<iostream>
#include<vector>

using namespace std;

typedef long long ll;

namespace comb {
	ll fact[500001];
	ll fact_inv[500001];
	const ll MOD = 1000000007;

	ll modpow(ll a, ll b) {
		ll base = 1, kakeru = a;
		while (b > 0) {
			if (b & 1)base *= kakeru, base %= MOD;
			kakeru *= kakeru, kakeru %= MOD;
			b >>= 1;
		}
		return base;
	}

	void setup() {
		fact[0] = 1, fact[1] = 1;
		for (int i = 2; i <= 500000; i++) {
			fact[i] = (fact[i - 1] * i) % MOD;
		}

		fact_inv[500000] = modpow(fact[500000], MOD - 2);

		for (int i = 499999; i >= 0; i--) {
			fact_inv[i] = fact_inv[i + 1] * (i + 1);
			fact_inv[i] %= MOD;
		}

	}

	ll combination(int a, int b) {
		if (a - b < 0)return 0;
		ll ret = fact[a];
		ret *= fact_inv[b], ret %= MOD;
		ret *= fact_inv[a - b], ret %= MOD;
		return ret;
	}

	ll permutation(int a, int b) {
		if (a - b < 0)return 0;
		ll ret = fact[a];
		ret *= fact_inv[a - b], ret %= MOD;
		return ret;
	}

	ll homogeneous(int a, int b) {
		return combination(a + b - 1, b);
	}

}

//このnamespace内のMODという値を、問題の要求に応じて変更すること
namespace Mint {

	//このMODという値を、問題の要求に応じて変更すること
	const ll MOD = 1000000007;

	template<ll Mod>
	struct Modint {
		ll val = 0;

		//コンストラクタ long long, 空, Modintを受け取れる
		Modint() = default;
		Modint(const Modint&) = default;
		Modint(ll _x) {
			val = _x >= 0 ? _x % Mod : ((_x % Mod) + Mod) % Mod;
		}

		//繰り返し二乗法、逆元　基本的に外部からいじるのやめたほうがよさそう。
		ll modpow(ll a, ll b) const {
			ll ret = 1, kakeru = a;
			while (b > 0) {
				if (b & 1)ret *= kakeru, ret %= Mod;
				kakeru *= kakeru, kakeru %= Mod;
				b >>= 1;
			}
			return ret;
		}
		Modint inv() const {
			return modpow((*this).val, MOD - 2);
		}

		//代入演算子　Modintとlong longの2通りある
		Modint operator= (const Modint& p) {
			val = p.val;
			return (*this);
		}

		//二項演算＋代入演算子　二項演算子、同値演算子はクラス外で定義する
		Modint& operator+= (const Modint& p) {
			val += p.val;
			if (val >= Mod)val -= Mod;
			return (*this);
		}
		Modint& operator-= (const Modint& p) {
			val -= p.val;
			if (val < 0)val += Mod;
			return (*this);
		}
		Modint& operator*= (const Modint& p) {
			val *= p.val;
			val %= Mod;
			return (*this);
		}
		Modint& operator/= (const Modint& p) {
			//なんか,p.inv()を使うとthisのポインターが変換できませんって出る
			//Modint tmp(p.inv());
			Modint tmp(modpow(p.val, MOD - 2));
			(*this) *= tmp;
			return (*this);
		}
	};

	//加算
	const Modint<MOD> operator+ (const Modint<MOD>& l, const Modint<MOD>& r) {
		Modint<MOD> tmp = l;
		tmp += r;
		return tmp;
	}
	const Modint<MOD> operator+ (const Modint<MOD>& l, const ll r) {
		Modint<MOD> tmp = l;
		tmp += Modint<MOD>(r);
		return tmp;
	}
	const Modint<MOD> operator+ (const ll l, const Modint<MOD>& r) {
		Modint<MOD> tmp = l;
		tmp += r;
		return tmp;
	}
	//減算
	const Modint<MOD> operator- (const Modint<MOD>& l, const Modint<MOD>& r) {
		Modint<MOD> tmp = l;
		tmp -= r;
		return tmp;
	}
	const Modint<MOD> operator- (const Modint<MOD>& l, const ll r) {
		Modint<MOD> tmp = l;
		tmp -= Modint<MOD>(r);
		return tmp;
	}
	const Modint<MOD> operator- (const ll l, const Modint<MOD>& r) {
		Modint<MOD> tmp = l;
		tmp -= r;
		return tmp;
	}
	//乗算
	const Modint<MOD> operator* (const Modint<MOD>& l, const Modint<MOD>& r) {
		Modint<MOD> tmp = l;
		tmp *= r;
		return tmp;
	}
	const Modint<MOD> operator* (const Modint<MOD>& l, const ll r) {
		Modint<MOD> tmp = l;
		tmp *= Modint<MOD>(r);
		return tmp;
	}
	const Modint<MOD> operator* (const ll l, const Modint<MOD>& r) {
		Modint<MOD> tmp = l;
		tmp *= r;
		return tmp;
	}
	//除算
	const Modint<MOD> operator/ (const Modint<MOD>& l, const Modint<MOD>& r) {
		Modint<MOD> tmp = l;
		tmp /= r;
		return tmp;
	}
	const Modint<MOD> operator/ (const Modint<MOD>& l, const ll r) {
		Modint<MOD> tmp = l;
		tmp /= Modint<MOD>(r);
		return tmp;
	}
	const Modint<MOD> operator/ (const ll l, const Modint<MOD>& r) {
		Modint<MOD> tmp = l;
		tmp /= r;
		return tmp;
	}
	//同値演算子
	const bool operator== (const Modint<MOD>& l, const Modint<MOD>& r) {
		return l.val == r.val;
	}
	const bool operator== (const Modint<MOD>& l, const ll r) {
		return l.val == r;
	}
	const bool operator== (const ll l, const Modint<MOD>& r) {
		return l == r.val;
	}
	const bool operator!= (const Modint<MOD>& l, const Modint<MOD>& r) {
		return !(l.val == r.val);
	}
	const bool operator!= (const Modint<MOD>& l, const ll r) {
		return !(l.val == r);
	}
	const bool operator!= (const ll l, const Modint<MOD>& r) {
		return !(l == r.val);
	}
	//istream ostream での入出力サポート
	std::ostream& operator<<(std::ostream& stream, const Modint<MOD>& p) {
		stream << p.val;
		return stream;
	}
	std::istream& operator >> (std::istream& stream, Modint<MOD>& p) {
		stream >> p.val;
		return stream;
	}
	//使う用の繰り返し二乗法 bはlong long に注意
	Modint<MOD> modpow(const Modint<MOD> a, ll b) {
		ll ret = 1, kakeru = a.val;
		while (b > 0) {
			if (b & 1)ret *= kakeru, ret %= MOD;
			kakeru *= kakeru, kakeru %= MOD;
			b >>= 1;
		}
		Modint<MOD> tmpret(ret);
		return tmpret;
	}
}

using namespace Mint;
using mint = Mint::Modint<MOD>;

int N;
vector<vector<int>> E;

int dp1_size[200000 + 100], dp2_size[200000 + 100];
mint dp1_ans[200000 + 100], dp2_ans[200000 + 100];

void dfs1(int pos, int bef) {
	dp1_ans[pos] = 1;
	dp1_size[pos] = 1;
	vector<int> div;
	for (int i = 0; i < E[pos].size(); i++) {
		int nxt = E[pos][i];
		if (nxt == bef)continue;

		dfs1(nxt, pos);
		
		dp1_size[pos] += dp1_size[nxt];
		dp1_ans[pos] *= dp1_ans[nxt];
		div.push_back(dp1_size[nxt]);
	}
	dp1_ans[pos] *= comb::fact[dp1_size[pos] - 1];
	for (int i = 0; i < div.size(); i++) {
		dp1_ans[pos] /= comb::fact[div[i]];
	}
}

void dfs2(int pos, int bef, int par_size, mint par_ans) {

	mint div_total = 1;

	dp2_size[pos] = 1, dp2_ans[pos] = 1;
	for (int i = 0; i < E[pos].size(); i++) {
		int neighbor = E[pos][i];
		if (neighbor == bef) {
			dp2_size[pos] += par_size;
			dp2_ans[pos] *= par_ans / comb::fact[par_size];
			div_total *= par_ans / comb::fact[par_size];
		}
		else {
			dp2_size[pos] += dp1_size[neighbor];
			dp2_ans[pos] *= dp1_ans[neighbor] / comb::fact[dp1_size[neighbor]];
			div_total *= dp1_ans[neighbor] / comb::fact[dp1_size[neighbor]];
		}
	}
	dp2_ans[pos] *= comb::fact[N - 1];

	//子供への伝播
	for (int i = 0; i < E[pos].size(); i++) {
		int nxt = E[pos][i];
		if (nxt == bef)continue;

		mint nxt_cnt = div_total * comb::fact[dp1_size[nxt]];
		nxt_cnt *= comb::fact[N - 1 - dp1_size[nxt]];
		nxt_cnt /= dp1_ans[nxt];
		dfs2(nxt, pos, N - dp1_size[nxt], nxt_cnt);

	}
}

int main() {
	comb::setup();
	cin >> N;
	E.resize(N);
	for (int i = 0; i < N - 1; i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		E[a].push_back(b), E[b].push_back(a);
	}

	dfs1(0, -1);

	dfs2(0, -1, 0, 1);

	for (int i = 0; i < N; i++) {
		cout << dp2_ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 26596