#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define int long long
#define ll long long
#define P pair<int,int>
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define all(V) V.begin(),V.end()
#ifdef int
constexpr int INF = LLONG_MAX / 10;
#else
constexpr int INF = INT_MAX / 10;
#endif
constexpr double eps = 1e-9;
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
using namespace std;
inline ll gcd(ll a, ll b) {
	while (b) {
		ll c = a;
		a = b; b = c % b;
	}
	return a;
}
inline ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
bool isprime(ll n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
ll mypow(ll a, ll b) {
	if (!b)return 1;
	if (b & 1)return mypow(a, b - 1) * a;
	ll memo = mypow(a, b >> 1);
	return memo * memo;
}
template<unsigned int modulo = 1000000007>
class modInt {
	ll value;
public:
	modInt() : value(0) {}
	template<typename T>
	modInt(T value = 0) : value(value) {
		if (value < 0)value = -(ll)(-value % modulo) + modulo;
		this->value = value % modulo;
	}
	inline operator int()const { return value; }
	inline modInt& operator+=(const modInt& x) {
		value += x.value;
		if (value >= modulo)value -= modulo;
		return *this;
	}
	inline modInt& operator++() {
		if (value == modulo - 1)value = 0;
		else value++;
		return *this;
	}
	inline modInt operator-()const {
		return modInt(0) -= *this;
	}
	inline modInt& operator-=(const modInt& x) {
		value -= x.value;
		if (value < 0)value += modulo;
		return *this;
	}
	inline modInt& operator--() {
		if (value == 0)value = modulo - 1;
		else value--;
		return *this;
	}
	inline modInt& operator*=(const modInt& x) {
		value = value * x.value % modulo;
		return *this;
	}
	inline modInt& operator/=(modInt rhs) {
		int exp = modulo - 2;
		while (exp) {
			if (exp & 1)*this *= rhs;
			rhs *= rhs;
			exp >>= 1;
		}
		return *this;
	}
	template<typename T> modInt operator+(const T& rhs)const { return modInt(*this) += rhs; }
	template<typename T> modInt& operator+=(const T& rhs) { return operator+=(modInt(rhs)); }
	template<typename T> modInt operator-(const T& rhs)const { return modInt(*this) -= rhs; }
	template<typename T> modInt& operator-=(const T& rhs) { return operator-=(modInt(rhs)); }
	template<typename T> modInt operator*(const T& rhs)const { return modInt(*this) *= rhs; }
	template<typename T> modInt& operator*=(const T& rhs) { return operator*=(modInt(rhs)); }
	template<typename T> modInt operator/(const T& rhs)const { return modInt(*this) /= rhs; }
	template<typename T> modInt& operator/=(const T& rhs) { return operator/=(modInt(rhs)); }
};
int n, siz[200010];
modInt<> fact[200010];
modInt<> ans[2][200010];
vector<int> vec[200010];
bool used[200010];
void dfs_sz(int node) {
	used[node] = true;
	siz[node] = 1;
	for (int i : vec[node]) {
		if (!used[i]) {
			dfs_sz(i);
			siz[node] += siz[i];
		}
	}
}
void func_1(int node) {
	used[node] = true;
	ans[0][node] = 1;
	for (int i : vec[node]) {
		if (!used[i]) {
			func_1(i);
			ans[0][node] *= ans[0][i];
			ans[0][node] /= fact[siz[i]];
		}
	}
	ans[0][node] *= fact[siz[node] - 1];
}
void func_2(int node, int s) {
	used[node] = true;
	ans[1][node] = 1;
	for (int i : vec[node]) {
		if (!used[i]) {
			ans[1][node] *= ans[0][i];
			ans[1][node] /= fact[siz[i]];
		}
	}
	ans[1][node] *= s;
	ans[1][node] /= fact[n - siz[node]];
	ans[1][node] *= fact[n - 1];
	for (int i : vec[node]) {
		if (!used[i]) {
			func_2(i, ans[1][node] / fact[n - 1] * fact[siz[i]] / ans[0][i] * fact[n - siz[i] - 1]);
		}
	}
}
signed main() {
	cin >> n;
	fact[0] = 1;
	REP(i, n)fact[i] = fact[i - 1] * i;
	rep(i, n - 1) {
		int a, b;
		cin >> a >> b;
		vec[a].push_back(b);
		vec[b].push_back(a);
	}
	dfs_sz(1);
	fill(used + 1, used + n + 1, false);
	func_1(1);
	ans[1][1] = ans[0][1];
	fill(used + 1, used + n + 1, false);
	func_2(1, 1);
	REP(i, n)cout << ans[1][i] << endl;
	return 0;
}

Measured memory_bytes: 21104