#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m-1); i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
#define fst first
#define snd second
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}
template<typename T> inline int Log2(T& x) {int k; for(k=0; (T(1)<<k)<=x; ++k); return k;} // number of binary digits


const int mod = int(1e9)+7;
struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


// initialization
const int F_MAX = int(2e5)+10;
mint fac[F_MAX], finv[F_MAX];
void binom_init() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  for (int i = 2; i < F_MAX; ++i) {
    fac[i] = fac[i-1] * i;
    finv[i] = finv[i-1] / i;
  }
}

mint binom(int n, int k) {
  if (k < 0 || n < k) return 0;
  return fac[n] * finv[k] * finv[n-k];
}


// DP
using Tdp = pair<mint, int>;
struct edge {
  int u, v; Tdp dp_sub;
  edge(int v) : u(-1), v(v), dp_sub() {}
};
Tdp f_merge(Tdp a, Tdp b) {
  return Tdp(a.fst * b.fst * binom(a.snd + b.snd, a.snd), a.snd + b.snd);
}
Tdp f_trans(Tdp a) {
  return Tdp(a.fst, a.snd+1);
}

using Edges = vector<edge>;
using Graph = vector<Edges>;
Graph G;

Tdp dfs(int u, int p=-1) {
  Tdp res = Tdp(1, 0);
  int d = G[u].size();
  for (auto &e : G[u]) {
    if (e.v == p) continue;
    e.dp_sub = dfs(e.v, u);
    res = f_merge(res, e.dp_sub);
  }
  return f_trans(res);
}

vector<Tdp> dp;
void dfs2(int u, Tdp par, int p=-1) {
  int d = G[u].size();
  rep(i, d) if (G[u][i].v == p) G[u][i].dp_sub = par;

  dp[u] = Tdp(1, 0);
  for (auto &e : G[u]) dp[u] = f_merge(dp[u], e.dp_sub);

  vector<Tdp> res_l(d+1, Tdp(1, 0));
  vector<Tdp> res_r(d+1, Tdp(1, 0));
  rep(i, d)  res_l[i+1] = f_merge(res_l[i], G[u][i].dp_sub);
  drep(i, d) res_r[i] = f_merge(res_r[i+1], G[u][i].dp_sub);

  rep(i, d) {
    auto e = G[u][i];
    if (e.v == p) continue;
    dfs2(e.v, f_trans(f_merge(res_l[i], res_r[i+1])), u);
  }
}


int main() {
  binom_init();
  int N; cin >> N;

  G = Graph(N);
  for (int i = 0; i < N-1; ++i) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(edge(b));
    G[b].push_back(edge(a));
  }

  dp = vector<Tdp>(N);
  dfs(0);
  dfs2(0, Tdp(1, 0));
  rep(i, N) cout << dp[i].fst << endl;
  return 0;
}

Measured memory_bytes: 28844