#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

const int inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;

// -------------------------------------------------------

const int MAX = 1010101;

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

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

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

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

ll N;
vector<ll> Graph[201010];
ll dp[201010];
ll nodes_cnt[201010];

void dfs(ll root, ll par) {
  for (auto e : Graph[root]) {
    if (e == par) continue;

    dfs(e, root);
    nodes_cnt[root] += nodes_cnt[e];
    dp[root] *= dp[e] * binom(nodes_cnt[root], nodes_cnt[e]) % MOD;
    dp[root] %= MOD;
  }

  ++nodes_cnt[root];
}

ll dp2[201010];
ll ans[201010];

void dfs2(ll root, ll from) {
  ans[root] = dp[root];

  ll deg = Graph[root].size();
  vector<ll> cumFromTail(deg + 1);
  cumFromTail[deg] = 1;
  vector<ll> cumNodeCntFromTail(deg + 1);
  cumNodeCntFromTail[deg] = 0;
  for (ll i = deg - 1; i >= 0; --i) {
    cumNodeCntFromTail[i] =
        cumNodeCntFromTail[i + 1] + nodes_cnt[Graph[root][i]];
    cumFromTail[i] = cumFromTail[i + 1] * dp[Graph[root][i]] % MOD *
                     binom(cumNodeCntFromTail[i], nodes_cnt[Graph[root][i]]) %
                     MOD;
  }

  vector<ll> cum(deg + 1);
  cum[0] = 1;
  vector<ll> cumNodeCnt(deg + 1);
  cumNodeCnt[0] = 0;
  for (ll i = 0; i < deg; ++i) {
    ll nv = Graph[root][i];
    cumNodeCnt[i + 1] = cumNodeCnt[i] + nodes_cnt[nv];
    cum[i + 1] =
        cum[i] * dp[nv] % MOD * binom(cumNodeCnt[i + 1], nodes_cnt[nv]) % MOD;
  }

  for (ll i = 0; i < deg; ++i) {
    ll nv = Graph[root][i];
    if (nv == from) continue;

    ll prevDpRoot = dp[root];
    ll prevNodesCntRoot = nodes_cnt[root];
    ll prevDpNv = dp[nv];
    ll prevNodesCntNv = nodes_cnt[nv];

    dp[root] = cum[i] * cumFromTail[i + 1] % MOD *
               binom(cumNodeCnt[i] + cumNodeCntFromTail[i + 1],
                     cumNodeCntFromTail[i + 1]) %
               MOD;
    nodes_cnt[root] = cumNodeCnt[i] + cumNodeCntFromTail[i + 1] + 1;
    /*
    cout << nv << " " << dp[nv] << " " << dp[root] << " " << nodes_cnt[nv]
         << " " << nodes_cnt[root] << endl;
         */
    dp[nv] = dp[nv] * dp[root] % MOD *
             binom(nodes_cnt[nv] - 1 + nodes_cnt[root], nodes_cnt[root]) % MOD;
    nodes_cnt[nv] += nodes_cnt[root];
    dfs2(nv, root);

    dp[root] = prevDpRoot;
    nodes_cnt[root] = prevNodesCntRoot;
    dp[nv] = prevDpNv;
    nodes_cnt[nv] = prevNodesCntNv;
  }
}

int main() {
  binom_init();
  cin >> N;
  rep(i, 0, N - 1) {
    ll a, b;
    cin >> a >> b;
    Graph[a].push_back(b);
    Graph[b].push_back(a);
  }

  repe(i, 1, N) { dp[i] = 1; }

  dfs(1, -1);
  dfs2(1, -1);

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


Measured memory_bytes: 50192