#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 rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
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 = 1000000007;
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;}
using Vm = vector<mint>;


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

// binom mod MOD
long long binom(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


using Graph = vector<vector<int>>;
Graph G;
vector<Vm> dp;
VV n_node;
pair<mint, int> dfs(int u, int p=-1) {
  mint res = 1;
  int res_node = 0;
  int d = G[u].size();
  dp[u] = Vm(d);
  n_node[u] = V(d);

  rep(i, d) {
    int v = G[u][i];
    if (v == p) continue;
    auto pa = dfs(v, u);
    dp[u][i] = pa.first;
    n_node[u][i] = pa.second;
    res *= dp[u][i];
    res_node += n_node[u][i];
  }
  res *= mint(fac[res_node]);
  rep(i, d) {
    int v = G[u][i];
    if (v == p) continue;
    res /= mint(fac[n_node[u][i]]);
  }
  res_node++;
  return make_pair(res, res_node);
}


Vm ans;
void dfs2(int u, mint x, int y, int p=-1) {
  int d = dp[u].size();

  rep(i, d) {
    if (G[u][i] == p) {
      dp[u][i] = x;
      n_node[u][i] = y;
    }
  }

  ans[u] = 1;
  int sum_n = 0;
  rep(i, d) {
    ans[u] *= dp[u][i];
    sum_n += n_node[u][i];
  }
  ans[u] *= mint(fac[sum_n]);
  rep(i, d) ans[u] /= mint(fac[n_node[u][i]]);

  // cout << u << ": " << endl;
  // rep(i, d) cout << dp[u][i] << endl;

  rep(i, d) {
    int v = G[u][i];
    if (v == p) continue;
    mint z = ans[u];
    z /= dp[u][i];
    z /= mint(binom(sum_n, n_node[u][i]));
    dfs2(v, z, sum_n+1-n_node[u][i], 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(b);
    G[b].push_back(a);
  }

  dp = vector<Vm>(N);
  n_node = VV(N);
  ans = Vm(N);

  dfs(0);
  dfs2(0, 1, 0);
  
  rep(i, N) cout << ans[i] << endl;
  return 0;
}

Measured memory_bytes: 44404