#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
constexpr ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

ll N;

using Graph = vector<vector<int>>;
vector<ll> sz(202020, 0);
vector<ll> tmp(202020, 0);
vector<ll> ans(202020, 0);

const ll N_MAX = 202020;

ll inv[N_MAX],fac[N_MAX],finv[N_MAX];
void make(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<N_MAX;i++){
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        fac[i]=fac[i-1]*(ll) i%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

pll dfs1(ll now, ll par, Graph &G){
	ll s = 0;
	ll val = 1;
	for(auto next: G[now]){
		if(next == par) continue;
		auto tmp = dfs1(next, now, G);
		s += tmp.first;
		val *= tmp.second;
		val %= mod;
		val *= finv[tmp.first];
		val %= mod;
	}
	val *= fac[s];
	val %= mod;
	s++;
	sz[now] = s;
	tmp[now] = val;
	return {s, val};
}

void dfs2(ll now, ll par, Graph &G, ll ageru){
	ll S = 1;
	ll V = 1;
	for(auto next: G[now]){
		if(next == par){
			if(next != -1){
				S *= finv[N-sz[now]];
				S %= mod;
				V *= ageru;
				V %= mod;
			}
		}else{
			S *= finv[sz[next]];
			S %= mod;
			V *= tmp[next];
			V %= mod;
		}
	}
	ans[now] = S * V;
	ans[now] %= mod;
	ans[now] *= fac[N-1];
	ans[now] %= mod;

	for(auto next: G[now]){
		if(next == par) continue;

		ll next_ageru = S*V%mod;
		next_ageru *= fac[sz[next]];
		next_ageru %= mod;
		next_ageru *= modinv(tmp[next], mod);
		next_ageru %= mod;
		next_ageru *= fac[N-sz[next]-1];
		next_ageru %= mod;

		dfs2(next, now, G, next_ageru);
	}
	return;
}

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

    cin >> N;
    Graph G(N);
    REP(i, N-1){
    	ll a, b;
    	cin >> a >> b;
    	a--, b--;
    	G[a].push_back(b);
    	G[b].push_back(a);
    }

    dfs1(0, -1, G);
    dfs2(0, -1, G, 1);
    REP(i, N) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 23412