#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <cassert>
#include <random>



// Modint
struct Mint {
	static const long long mod = (long long)(1e9 + 7);
	long long val;

	Mint() { val = 0; }
	Mint(long long a) { val = a; verify_value(); }

	void verify_value() {
		if (val >= mod) val %= mod;
		if (val < 0) val %= mod, val += mod;
	}

	Mint pow(long long p) const {
		Mint cur = Mint(val), ret = 1;
		while (p > 0) {
			if (p & 1) ret *= cur;
			cur *= cur;
			p >>= 1LL;
		}
		return ret;
	}
	Mint inv() const {
		if (val == 0)
			std::cerr << "WARNING: inv() is called with 0." << std::endl;
		return pow(mod - 2);
	}

	Mint operator+() const { return *this; }
	Mint operator-() const { return Mint(mod - val); }

	Mint operator+=(const Mint &a) {
		val += a.val;
		if (val >= mod) val -= mod;
		return Mint(val);
	}
	Mint operator*=(const Mint &a) {
		val *= a.val;
		if (val >= mod) val %= mod;
		return Mint(val);
	}
	Mint operator-=(const Mint &a) { return *this += -a; }
	Mint operator/=(const Mint &a) { return *this *= a.inv(); }

	Mint operator++() { return *this += Mint(1); }
	Mint operator--() { return *this -= Mint(1); }
	Mint operator++(int) {
		Mint ret = *this;
		++(*this);
		return ret;
	}
	Mint operator--(int) {
		Mint ret = *this;
		--(*this);
		return ret;
	}

	operator long long() const { return val; }
};

Mint operator+(const Mint &a, const Mint &b) {
	long long ret = a.val + b.val;
	if (ret >= Mint::mod) ret -= Mint::mod;
	return Mint(ret);
}
Mint operator*(const Mint &a, const Mint &b) {
	long long ret = a.val * b.val;
	if (ret >= Mint::mod) ret %= Mint::mod;
	return Mint(ret);
}
Mint operator-(const Mint &a, const Mint &b) { return a + (-b); }
Mint operator/(const Mint &a, const Mint &b) { return a * b.inv(); }

std::ostream &operator<<(std::ostream &out, const Mint &a) { return out << a.val; }
std::istream &operator>>(std::istream &in, Mint &a) {
	in >> a.val;
	a.verify_value();
	return in;
}

Mint pow(Mint a, long long b) {
	return a.pow(b);
}


// Combinatorics
constexpr int MAX_N = 200003;
Mint fact[MAX_N], inv[MAX_N];

void init_fact() {
	fact[0] = inv[0] = 1;
	for (long long i = 1; i < MAX_N; i++) {
		fact[i] = fact[i - 1] * Mint(i);
		inv[i] = fact[i].inv();
	}
}

// aCb
Mint C(int a, int b) {
	if (a < b) return 0;
	Mint res = fact[a];
	res *= inv[b];
	res *= inv[a - b];
	return res;
}


int main() {
	init_fact();
	int n; std::cin >> n;
	std::vector<std::vector<int>> edg(n);
	for (int i = 0; i < n - 1; i++) {
		int a, b; std::cin >> a >> b;
		a--; b--;
		edg[a].push_back(b);
		edg[b].push_back(a);
	}
	std::vector<Mint> dp(n);
	std::vector<int> cnt(n);
	auto func1 = [&](auto &self, int pos, int prev=-1) -> void {
		for (int c : edg[pos]) {
			if (c == prev) continue;
			self(self, c, pos);
		}
		dp[pos] = 1;
		for (int c : edg[pos]) {
			if (c == prev) continue;
			cnt[pos] += cnt[c] + 1;
			dp[pos] *= dp[c];
		}
		int n = cnt[pos];
		for (int c : edg[pos]) {
			if (c == prev) continue;
			dp[pos] *= C(n, cnt[c] + 1);
			n -= cnt[c] + 1;
		}
	};
	func1(func1, 0);

	std::vector<Mint> ans(n);
	auto func2 = [&](
			auto &self, int pos,
			int prev = -1, Mint prevv = -1, int prevn=-1) -> void {
		int n = 0;
		ans[pos] = 1;
		for (int c : edg[pos]) {
			if (c == prev) {
				n += prevn + 1;
				ans[pos] *= prevv;
			}
			else {
				n += cnt[c] + 1;
				ans[pos] *= dp[c];
			}
		}
		int w = n;
		for (int c : edg[pos]) {
			if (c == prev) {
				ans[pos] *= C(w, prevn + 1);
				w -= prevn + 1;
			}
			else {
				ans[pos] *= C(w, cnt[c] + 1);
				w -= cnt[c] + 1;
			}
		}
		for (int c : edg[pos]) {
			if (c == prev) continue;
			self(self, c, pos, ans[pos]/dp[c]*fact[cnt[c]+1]*fact[n-cnt[c]-1]/fact[n], n - cnt[c] - 1);
		}
	};
	func2(func2, 0);

	for (int i = 0; i < n; i++) std::cout << ans[i] << std::endl;
	return 0;
}


Measured memory_bytes: 20980