#include<iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define rep(i,m,n) for(int (i)=(int)(m);(i)<(int)(n);(i)++)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;(i)>=(int)(m);(i)--)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;

typedef vector<ll> Array;
typedef vector<Array> Matrix;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

constexpr long long MOD = (ll) 1e9+7;

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

struct Edge {
	int to, cap, rev;
	Edge(int _to, int _cap, int _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, int from, int to, int cap, bool revFlag, int revCap) {
	G[from].push_back(Edge(to, cap, G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, G[from].size() - 1));
}

ll con[201010];//個数
ll dp1[201010];//くみあわせ
ll dp2[201010];

ll fact[201010];
ll inv[201010];

ll n;

ll mod_inv(ll x) {
	ll n = MOD - 2;
	ll res = 1LL;
	while (n > 0) {
		if (n & 1) res = res * x % MOD;
		x = x * x % MOD;
		n >>= 1;
	}
	return res;
}

void dfs1(Graph&g, int v, int p) {
	for (auto e : g[v]) {
		if (e.to == p) continue;
		dfs1(g, e.to, v);
		con[v] += con[e.to];
	}
	dp1[v] = fact[con[v]];

	for (auto e : g[v]) {
		if (e.to == p) continue;
		(dp1[v] *= inv[con[e.to]])%=MOD;
		(dp1[v] *= dp1[e.to]) %= MOD;
	}
	//cout << v << " " << dp1[v] << en;
	con[v]++;
}

void dfs2(Graph& g, int v, int p, ll pval, ll pcon) {
	//cout << v << " " << p << " " << pval << " " << pcon << en;
	dp2[v] = fact[n-1];
	for (auto e : g[v]) {
		if (e.to == p) (dp2[v] *= inv[pcon]) %= MOD;
		else (dp2[v] *= inv[con[e.to]]) %= MOD;
	}
	for (auto e : g[v]) {
		if (e.to == p) (dp2[v] *= pval) %= MOD;
		else (dp2[v] *= dp1[e.to]) %= MOD;
	}
	for (auto e : g[v]) {
		if (e.to == p) continue;
		ll nval = dp2[v];
		(nval *= mod_inv(dp1[e.to])) %= MOD;
		(nval *= fact[con[e.to]]) %= MOD;

		(nval *= inv[n-1]) %= MOD;
		(nval *= fact[n - 1 - con[e.to]]) %= MOD;
		
		dfs2(g, e.to, v, nval, n - con[e.to]);
	}
}


void solve() {
	cin >> n;
	Graph g(n);
	REP(i, n-1) {
		ll x, y;
		cin >> x >> y;
		x--; y--;
		add_edge(g, x, y, 1, true, 1);
	}

	fact[0] = 1;
	REP(i, n) fact[i + 1] = fact[i] * (i + 1) % MOD;
	inv[n] = mod_inv(fact[n]);
	for (int i = n; i > 0; i--) {
		inv[i - 1] = inv[i] * i % MOD;
	}

	dfs1(g, 0, -1);
	dfs2(g, 0, -1, 1LL,0);

	//REP(i, n) cout << dp1[i] << en;
	REP(i, n) cout << dp2[i] % MOD << en;

}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	solve();
	//int t; cin >> t; REP(i, t) solve();

	return 0;
}


Measured memory_bytes: 24960