#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;
const 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;
	vector<ll> sizes;
	for(auto next: G[now]){
		if(next == par) continue;
		pll tmp = dfs1(next, now, G);
		s += tmp.first;
		sizes.push_back(tmp.first);
		val *= tmp.second;
		val %= mod;
	}
	
	val *= fac[s];
	val %= mod;
	REP(i, sizes.size()){
		val *= finv[sizes[i]];
		val %= mod;
	}

	s++;
	sz[now] = s;
	tmp[now] = val;
	return {s, val};
}
 
void dfs2(ll now, ll par, Graph &G, ll age){
	ll res = 1;
	for(auto next: G[now]){
		if(next == par){
			if(par != -1){
				res *= age;
				res %= mod;	
				res *= finv[N-sz[now]];
				res %= mod;
			}
		}else{
			res *= tmp[next];
			res %= mod;
			res *= finv[sz[next]];
			res %= mod;
		}
	}

	for(auto next: G[now]){
		if(next == par) continue;
		ll nval = res * fac[sz[next]];
		nval %= mod;
		nval *= modinv(tmp[next], mod);
		nval %= mod;
		nval *= fac[N-1-sz[next]];
		nval %= mod;
		dfs2(next, now, G, nval);
	}

	res *= fac[N-1];
	res %= mod;
	ans[now] = res;
	return;
}

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

    cin >> N;


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

    dfs1(0, -1, G);
    dfs2(0, -1, G, 1);

    REP(i, N){
    	cout << ans[i] << endl;
    }

    /*
    REP(i, N) cerr << sz[i] << " ";
    cerr << endl;
    REP(i, N) cerr << tmp[i] << " ";
    cerr << endl;
    */
    return 0;
}

Measured memory_bytes: 23668