#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;
}

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;
}

template< typename sum_t, typename key_t >
struct ReRooting {
  struct Edge {
    int to;
    key_t data;
    sum_t dp, ndp;
  };

  using F = function< sum_t(sum_t, sum_t) >;
  using G = function< sum_t(sum_t, key_t) >;

  // subdp: 一度目のdfsの結果を保持する配列
  // dp: 二度目のdfsの後，結果を各頂点でマージした値を保持する配列
  vector< vector< Edge > > g;
  const F f;
  const G gg;
  const sum_t ident;
  vector< sum_t > subdp, dp;

  ReRooting(int V, const F f, const G g, const sum_t &ident)
      : g(V), f(f), gg(g), ident(ident), subdp(V, ident), dp(V, ident) {}

  void add_edge(int u, int v, const key_t &d) {
    g[u].emplace_back((Edge) {v, d, ident, ident});
    g[v].emplace_back((Edge) {u, d, ident, ident});
  }

  void add_edge_bi(int u, int v, const key_t &d, const key_t &e) {
    g[u].emplace_back((Edge) {v, d, ident, ident});
    g[v].emplace_back((Edge) {u, e, ident, ident});
  }

  // 一度目のdfs
  void dfs_sub(int idx, int par) {
    for(auto &e : g[idx]) {
      if(e.to == par) continue;
      dfs_sub(e.to, idx);
      subdp[idx] = f(subdp[idx], gg(subdp[e.to], e.data));
    }
  }

  // 二度目のdfs
  void dfs_all(int idx, int par, const sum_t &top) {
    sum_t buff{ident};
    for(int i = 0; i < (int) g[idx].size(); i++) {
      auto &e = g[idx][i];
      e.ndp = buff;
      e.dp = gg(par == e.to ? top : subdp[e.to], e.data);
      buff = f(buff, e.dp);
    }
    dp[idx] = buff;
    buff = ident;
    for(int i = (int) g[idx].size() - 1; i >= 0; i--) {
      auto &e = g[idx][i];
      if(e.to != par) dfs_all(e.to, idx, f(e.ndp, buff));
      e.ndp = f(e.ndp, buff);
      buff = f(buff, e.dp);
    }
  }

  vector< sum_t > build() {
    dfs_sub(0, -1);
    dfs_all(0, -1, ident);
    return dp;
  }
};

ll combination(ll C, ll D){
    if(C<D||C<0) return 0;
    return fac[C]*(finv[D]*finv[C-D]%mod)%mod;
}

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

   	ll N;
   	cin >> N;
   	vector<pll> E(N-1);
   	REP(i, N-1){
   		ll a, b;
   		cin >> a >> b;
   		a--, b--;
   		E[i].first = a;
   		E[i].second = b;
   	}

   	auto f1 = [](pll a, pll b){
   		pll tmp;
   		tmp.first = (a.first * b.first)%mod;
      tmp.first *= combination(a.second+b.second, a.second);
      tmp.first %= mod;
   		tmp.second = a.second + b.second;
    	return tmp;
    };

    auto f2 = [](pll a, ll data){
      pll tmp;
      tmp.first = a.first;
      tmp.second = a.second + data;
    	return tmp;
    };

    pll e = {1ll, 0ll};
   	ReRooting<pll, ll> RR(N, f1, f2, e);
   	REP(i, N-1){
   		RR.add_edge(E[i].first, E[i].second, 1);
   	}
   	RR.build();

   	vector<ll> bai(N, 1);
   	REP(i, N){
      ll cum = 0;
   		REP(j, RR.g[i].size()){
   			bai[i] *= RR.g[i][j].dp.first;
   			bai[i] %= mod;
        bai[i] *= combination(cum+RR.g[i][j].dp.second, cum);
        bai[i] %= mod;
        cum += RR.g[i][j].dp.second;
   		}
      //bai[i] *= fac[N-1];
      //bai[i] %= mod;
   	}

   	REP(i, N) cout << bai[i] << endl;
    return 0;
}

Measured memory_bytes: 48328