// https://atcoder.jp/contests/abc160/tasks/abc160_f

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define FORR(i,b,e) for(int i=(b); i>=(int)(e); i--)

#if DEBUG
  #define DUMP(a) REP(_i, a.size()) cout << a[_i] << (_i + 1 == a.size() ? "\n" : " ")
  #define DUMP2D(b) REP(_j, b.size()) DUMP(b[_j]); cout << endl
#else
  #define DUMP(a)
  #define DUMP2D(b)
#endif

//------------------------------------------------------------------------------
int extgcd(int a, int b, int &x, int &y) {
  int ret = a;
  if (b == 0) {
    x = 1;
    y = 0;
  } else {
    ret = extgcd(b, a % b, y, x);
    y -= (a / b) * x;
  }
  return ret;
}

int mod_inverse(int a, int m) {
  int x, y;
  extgcd(a, m, x, y);
  return (m + x % m) % m;
}

//------------------------------------------------------------------------------
const int F_MAX = 2*1e5;

ll fact[F_MAX + 1];
ll fact_inv[F_MAX + 1];

void init_fact(int m) {
  fact[0] = 1LL;
  FOR(i, 1, F_MAX) fact[i] = fact[i - 1] * i % m;
  fact_inv[F_MAX] = mod_inverse(fact[F_MAX], m);
  FORR(i, F_MAX - 1, 0) fact_inv[i] = fact_inv[i + 1] * (i + 1) % m;
}

//------------------------------------------------------------------------------
const int N_MAX = 2*1e5;
const int MOD = 1e9+7;

//------------------------------------------------------------------------------
struct Rerooting {
  struct DP {
    int k;
    ll p;
    DP() {}
    DP(int k, ll p) : k(k), p(p) {}
    friend ostream& operator<<(ostream& os, const DP& dp) {
      os << '(' << dp.k << ',' << dp.p << ')';
      return os;
    }
  };

  const DP identity = DP(0, 1LL);

  function<DP(DP, DP)> merge = [](DP acc, DP d) -> DP {
    int k = acc.k + d.k;
    ll p = acc.p * d.p % MOD;
    p = p * fact[k] % MOD;
    p = p * fact_inv[acc.k] % MOD;
    p = p * fact_inv[d.k] % MOD;
    return DP(k, p);
  };

  function<DP(DP)> add_root = [](DP d) -> DP {
    return DP(d.k + 1, d.p);
  };

  using Graph = vector<vector<int>>;

  Graph G;
  vector<vector<DP>> dp_edge;
  vector<DP> dp_node;

  Rerooting() {}

  Rerooting(int N) : G(N) {
    dp_edge = vector<vector<DP>>(N);
    dp_node = vector<DP>(N);
  }

  void add_edge(int u, int v) {
    G[u].push_back(v);
    G[v].push_back(u);
  }

  void build() {
    dfs(0);
    dfs2(0, identity);
  }

  DP dfs(int v, int p = -1) {
    int deg = G[v].size();
    dp_edge[v] = vector<DP>(deg);
    DP acc = identity;
    REP(i, deg) {
      int u = G[v][i];
      if (u == p) continue;
      dp_edge[v][i] = dfs(u, v);
      acc = merge(acc, dp_edge[v][i]);
    }
    return add_root(acc);
  }

  void dfs2(int v, const DP& dp_p, int p = -1) {
    int deg = G[v].size();

    REP(i, deg) if (G[v][i] == p) dp_edge[v][i] = dp_p;

    vector<DP> accL = vector<DP>(deg + 1);
    accL[0] = identity;
    REP(i, deg) accL[i + 1] = merge(accL[i], dp_edge[v][i]);

    vector<DP> accR = vector<DP>(deg + 1);
    accR[deg] = identity;
    for (int i = deg - 1; i >= 0; i--) accR[i] = merge(accR[i + 1], dp_edge[v][i]);

    // cout << "v:" << v << endl;
    // cout << "  dp_edge:" << endl << "  ";
    // REP(i, deg) cout << dp_edge[v][i];
    // cout << endl;
    // cout << "  accL:" << endl << "  ";
    // REP(i, deg + 1) cout << accL[i];
    // cout << endl;
    // cout << "  accR:" << endl << "  ";
    // REP(i, deg + 1) cout << accR[i];
    // cout << endl;

    dp_node[v] = add_root(accL[deg]);

    REP(i, deg) {
      int u = G[v][i];
      if (u == p) continue;
      DP dp_p = add_root(merge(accL[i], accR[i + 1]));
      dfs2(u, dp_p, v);
    }
  }

  void dump() {
    int N = G.size();
    cout << "dp_edge:" << endl;
    REP(v, N) {
      REP(i, G[v].size()) {
        cout << "  " << v << "-" << G[v][i] << " : " << dp_edge[v][i] << endl;
      }
    }

    cout << "dp_node:" << endl;
    REP(v, N) {
      cout << "  " << v << " : " << dp_node[v] << endl;
    }
  }
};

//------------------------------------------------------------------------------
int N;

int main() {
  cin >> N;

  init_fact(MOD);

  Rerooting rr(N);
  REP(i, N - 1) {
    int a, b;
    cin >> a >> b;
    rr.add_edge(a - 1, b - 1);
  }
  rr.build();
  // rr.dump();

  REP(i, N) cout << rr.dp_node[i].p << endl;
}


Measured memory_bytes: 54112