#include <iostream>
#include <vector>

long long modinv(long long n, long long MOD) {
	long long a = MOD, u = 1, v = 0;
	while (a) {
		long long t = n / a;
		n -= t * a; std::swap(n, a);
		u -= t * v; std::swap(u, v);
	}
	u %= MOD;
	if (u < 0) u += MOD;
	return u;
}

template<long long MOD> struct modint {
	long long value = 0;
	void f() {
		value %= MOD;
		if (value < 0) value += MOD;
	}
	modint(long long n) : value(n) {f();}
	modint() : value(0) {}
	modint<MOD> operator+(modint<MOD> right) {modint<MOD> ret = (this -> value) + right.value; return ret;}
	modint<MOD> operator-(modint<MOD> right) {modint<MOD> ret = (this -> value) - right.value; return ret;}
	modint<MOD> operator*(modint<MOD> right) {modint<MOD> ret = (this -> value) * right.value; return ret;}
	modint<MOD> operator/(modint<MOD> right) {modint<MOD> ret = (this -> value) * modinv(right.value, MOD); return ret;}
	modint<MOD> operator+=(modint<MOD> right) {return *this = *this + right;}
	modint<MOD> operator-=(modint<MOD> right) {return *this = *this - right;}
	modint<MOD> operator*=(modint<MOD> right) {return *this = *this * right;}
	modint<MOD> operator/=(modint<MOD> right) {return *this = *this / right;}
	bool operator<(modint<MOD> right) {return ((this -> value) < right.value);}
	bool operator>(modint<MOD> right) {return ((this -> value) > right.value);}
	bool operator==(modint<MOD> right) {return ((this -> value) == right.value);}
	bool operator!=(modint<MOD> right) {return ((this -> value) != right.value);}
	bool operator<=(modint<MOD> right) {return ((this -> value) <= right.value);}
	bool operator>=(modint<MOD> right) {return ((this -> value) >= right.value);}
	modint<MOD>& operator++() {*this += 1; return *this;}
	modint<MOD> operator++(int) {*this += 1; return *this - 1;}
	modint<MOD>& operator--() {*this -= 1; return *this;}
	modint<MOD> operator--(int) {*this -= 1; return *this + 1;}
};
template<long long MOD> modint<MOD> operator+(long long left, modint<MOD> right) {return right + left;}
template<long long MOD> modint<MOD> operator-(long long left, modint<MOD> right) {return right * -1 + left;}
template<long long MOD> modint<MOD> operator*(long long left, modint<MOD> right) {return right * left;}
template<long long MOD> modint<MOD> operator/(long long left, modint<MOD> right) {
	return modinv(right.value, MOD) * (left % MOD);
}

template<long long MOD> modint<MOD> modpow(modint<MOD> a, long long n) {
	if (n == 0) return 1;
	if (a == 0) return 0;
	modint<MOD> ret = a;
	long long cnt = 1;
	while (cnt * 2 <= n) {
		ret *= ret;
		cnt *= 2;
	}
	return ret * modpow<MOD>(a, n - cnt);
}

long long modpow(long long a, long long n, long long MOD) {
	if (n == 0) return 1;
	if (a == 0) return 0;
	long long ret = a % MOD, cnt = 1;
	while (cnt * 2 <= n) {
		ret *= ret; ret %= MOD;
		cnt *= 2;
	}
	return ret * modpow(a, n - cnt, MOD) % MOD;
}

std::vector<long long> factorial;
std::vector<long long> factorial_inv;

template<long long P> void make_table(int n) {
	factorial.resize(n + 1, 1);
	factorial_inv.resize(n + 1, 1);
	for (int i = 1; i <= n; i++) factorial[i] = factorial[i - 1] * i % P;
	factorial_inv[n] = modinv(factorial[n], P);
	for (int i = n - 1; i >= 0; i--) factorial_inv[i] = factorial_inv[i + 1] * (i + 1) % P;
}

template<long long P> modint<P> permutation(int n, int r) {
	if (n <= factorial.size()) return factorial[n] * factorial_inv[n - r];
	std::cerr << "attention : factorial table is not constructed" << std::endl;
	r = std::min(r, n - r);
	modint<P> ret = 1;
	for (int i = 0; i < r; i++) ret *= n - i;
	return ret;
}

template<long long P> modint<P> combination(int n, int r) {
	if (n <= factorial.size()) return permutation<P>(n, r) * factorial_inv[r];
	std::cerr << "attention : factorial table is not constructed" << std::endl;
	r = std::min(r, n - r);
	modint<P> ret = 1;
	for (int i = 0; i < r; i++) {
		ret *= n - i;
		ret /= i + 1;
	}
	return ret;
}

template<long long MOD> std::ostream& operator<<(std::ostream& os, const modint<MOD>& target) {
	os << target.value;
	return os;
}

constexpr int P = 1000000007;

struct rerooting {
	struct edge_rerooting {long long weight; int from, to, idx, reverse_idx;};
	struct DP {
		int cnt;
		modint<P> dp;
		DP merge(DP x) {
			return {cnt += x.cnt, dp *= x.dp * combination<P>(cnt, x.cnt)};
		}
		DP ascend(edge_rerooting e = {0, -1, 0, -1, -1}) {
			if (e.from == -1) return {cnt, dp};
			else return {++cnt, dp};
		}
	};

	int N;
	std::vector<std::vector<edge_rerooting>> adj_list;
	std::vector<std::vector<DP>> subtree_dp, left_sum, right_sum;
	std::vector<DP> ans;
	DP E = {0, 1};

	rerooting(int n) : N(n) {
		adj_list.resize(N); subtree_dp.resize(N); left_sum.resize(N); right_sum.resize(N); ans.resize(N);
	}

	void add_edge(int s, int t, long long w = 1) {
		adj_list[s].push_back({w, s, t, (int)adj_list[s].size(), (int)adj_list[t].size()});
		adj_list[t].push_back({w, t, s, (int)adj_list[t].size(), (int)adj_list[s].size() - 1});
		subtree_dp[s].push_back(E); subtree_dp[t].push_back(E);
	}

	DP dfs1(edge_rerooting now = {0, -1, 0, -1, -1}) {
		DP ret = E;
		for (auto e : adj_list[now.to]) {
			if (e.to == now.from) continue;
			ret.merge(subtree_dp[e.from][e.idx] = dfs1(e));
		}
		return ret.ascend(now);
	}

	void make_sum(int k) {
		int m = adj_list[k].size();
		left_sum[k].resize(m + 1, E); right_sum[k].resize(m + 1, E);
		for (int i = 0; i < m; i++) {
			left_sum[k][i + 1].merge(left_sum[k][i]); left_sum[k][i + 1].merge(subtree_dp[k][i]);
			right_sum[k][m - 1 - i].merge(right_sum[k][m - i]); right_sum[k][m - 1 - i].merge(subtree_dp[k][m - 1 - i]);
		}
	}

	void dfs2(edge_rerooting now = {0, -1, 0, -1, -1}) {
		if (now.to == 0) make_sum(0);
		else {
			subtree_dp[now.to][now.reverse_idx].merge(left_sum[now.from][now.idx]);
			subtree_dp[now.to][now.reverse_idx].merge(right_sum[now.from][now.idx + 1]);
			subtree_dp[now.to][now.reverse_idx].ascend({now.weight, now.to, now.from, now.reverse_idx, now.idx});
			make_sum(now.to);
			ans[now.to] = left_sum[now.to].back().ascend();
		}
		for (auto e : adj_list[now.to]) {
			if (e.to == now.from) continue;
			dfs2(e);
		}
	}

	void calculate() {
		ans[0] = dfs1();
		dfs2();
	}
};

int main() {
	int n;
	std::cin >> n;
	rerooting rr(n);
	for (int i = 0; i < n - 1; i++) {
		int a, b;
		std::cin >> a >> b;
		rr.add_edge(a - 1, b - 1);
	}
	make_table<P>(200000);
	rr.calculate();
	for (int i = 0; i < n; i++) std::cout << rr.ans[i].dp << '\n';

	return 0;
}

Measured memory_bytes: 77700