#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

#ifndef INCLUDED_MODINT_HPP
#define INCLUDED_MODINT_HPP

#include <iostream>

template <std::uint_fast64_t Modulus>
class modint {
	using u32 = std::uint_fast32_t;
	using u64 = std::uint_fast64_t;
	using i64 = std::int_fast64_t;

	inline u64 apply(i64 x) { return (x < 0 ? x + Modulus : x); };

public:
	u64 a;
	static constexpr u64 mod = Modulus;

	constexpr modint(const i64& x = 0) noexcept: a(apply(x % (i64)Modulus)) {}

	constexpr modint operator+(const modint& rhs) const noexcept { return modint(*this) += rhs; }
	constexpr modint operator-(const modint& rhs) const noexcept { return modint(*this) -= rhs; }	
	constexpr modint operator*(const modint& rhs) const noexcept { return modint(*this) *= rhs; }
	constexpr modint operator/(const modint& rhs) const noexcept { return modint(*this) /= rhs; }
	constexpr modint operator^(const u64& k) const noexcept { return modint(*this) ^= k; }
	constexpr modint operator^(const modint& k) const noexcept { return modint(*this) ^= k.value(); }
	constexpr modint operator-() const noexcept { return modint(Modulus - a); }
	constexpr modint operator++() noexcept { return (*this) = modint(*this) + 1; }
	constexpr modint operator--() noexcept { return (*this) = modint(*this) - 1; }
	const bool operator==(const modint& rhs) const noexcept { return a == rhs.a; };
	const bool operator!=(const modint& rhs) const noexcept { return a != rhs.a; };
	const bool operator<=(const modint& rhs) const noexcept { return a <= rhs.a; };
	const bool operator>=(const modint& rhs) const noexcept { return a >= rhs.a; };
	const bool operator<(const modint& rhs) const noexcept { return a < rhs.a; };
	const bool operator>(const modint& rhs) const noexcept { return a > rhs.a; };
	constexpr modint& operator+=(const modint& rhs) noexcept {
		a += rhs.a;
		if (a >= Modulus) a -= Modulus;
		return *this;
	}
	constexpr modint& operator-=(const modint& rhs) noexcept {
		if (a < rhs.a) a += Modulus;
		a -= rhs.a;
		return *this;
	}
	constexpr modint& operator*=(const modint& rhs) noexcept {
		a = a * rhs.a % Modulus;
		return *this;
	}
	constexpr modint& operator/=(modint rhs) noexcept {
		u64 exp = Modulus - 2;
		while (exp) {
			if (exp % 2) (*this) *= rhs;
			
			rhs *= rhs;
			exp /= 2;
		}
		return *this;
	}
	constexpr modint& operator^=(u64 k) noexcept {
		auto b = modint(1);
		while(k) {
			if(k & 1) b = b * (*this);
			(*this) *= (*this);
			k >>= 1;
		}
		return (*this) = b;
	}
	constexpr modint& operator=(const modint& rhs) noexcept {
		a = rhs.a;
		return (*this);
	}

	constexpr u64& value() noexcept { return a; }
	constexpr const u64& value() const noexcept { return a; }
	explicit operator bool() const { return a; }
	explicit operator u32() const { return a; }

	const modint inverse() const {
		return modint(1) / *this;
	}
	const modint pow(i64 k) const {
		return modint(*this) ^ k;
	}

	friend std::ostream& operator<<(std::ostream& os, const modint& p) {
		return os << p.a;
	}
	friend std::istream& operator>>(std::istream& is, modint& p) {
		u64 t;
		is >> t;
		p = modint(t);
		return is;
	}
};

#endif
using mint = modint<(int)(1e9 + 7)>;

int main() {
	int n; scanf("%d", &n);
	std::vector<int> a(n - 1), b(n - 1);
	std::vector<std::vector<int>> g(n);
	for(int i = 0; i < n - 1; i++) {
		scanf("%d%d", &a[i], &b[i]);
		a[i]--; b[i]--;

		g[a[i]].push_back(i);
		g[b[i]].push_back(i);
	}

	std::vector<mint> fact(n + 1, 1);
	for(int i = 1; i < fact.size(); i++) fact[i] = fact[i - 1] * mint(i);

	std::vector<std::map<int, int>> size(n);
	auto f = [&](auto&& f, int v, int par, bool flag) -> int {
		if(size[v].count(par)) return size[v][par];

		int val = 1;
		if(par == -1 or flag) {
			for(int id: g[v]) {
				int to = a[id] ^ b[id] ^ v;
				if(to == par) continue;

				val += f(f, to, v, flag);
			}
		} else {
			int all = f(f, v, -1, true);
			int sub = f(f, par, v, false);

			val = all - sub;
		}

		return size[v][par] = val;
	};
	f(f, 0, -1, 1);

	std::vector<std::map<int, mint>> dp(n);
	auto dfs = [&](auto&& dfs, int v, int par, bool flag) -> mint {
		if(dp[v].count(par)) return dp[v][par];

		int sum = 0;
		mint val = 1;
		if(par == -1 or flag) {
			for(int id: g[v]) {
				int to = a[id] ^ b[id] ^ v;
				if(to == par) continue;
				int tmp = f(f, to, v, flag);

				val *= dfs(dfs, to, v, flag) / fact[tmp];
				sum += tmp;
			}
			val *= fact[sum];
		} else {
			mint all = dfs(dfs, v, -1, true);
			mint sub = dfs(dfs, par, v, false);
			int sum = f(f, v, -1, true) - 1;
			int tmp = f(f, par, v, false);

			all /= fact[sum];
			all *= fact[sum - tmp];
			all /= sub / fact[tmp];
			val = all;
		}
		
		return dp[v][par] = val;
	};
	dfs(dfs, 0, -1, 1);

	for(int i = 0; i < n; i++) printf("%d\n", dfs(dfs, i, -1, 0));
	return 0;
}



Measured memory_bytes: 95488