// 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--)

#define DEBUG 0
#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;
}

//------------------------------------------------------------------------------
vector<ll> fact;
vector<ll> fact_inv;

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

//------------------------------------------------------------------------------
template<class T>
struct Rerooting {
  using Graph = vector<vector<int>>;

  T identity ;
  function<T(T, T)> merge;
  function<T(T)> add_root;

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

  Rerooting() {}

  Rerooting(int N, T _identity, function<T(T, T)> _merge, function<T(T)> _add_root) : G(N) {
    identity = _identity;
    merge = _merge;
    add_root = _add_root;
    dp_edge = vector<vector<T>>(N);
    dp_node = vector<T>(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);
  }

  T dfs(int v, int p = -1) {
    int deg = G[v].size();
    dp_edge[v] = vector<T>(deg);
    T 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 T& 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<T> accL = vector<T>(deg + 1);
    accL[0] = identity;
    REP(i, deg) accL[i + 1] = merge(accL[i], dp_edge[v][i]);

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

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

    REP(i, deg) {
      int u = G[v][i];
      if (u == p) continue;
      T 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;
    }
  }
};

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

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 my_identity = DP(0, 1LL);

function<DP(DP, DP)> my_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)> my_add_root = [](DP d) -> DP {
  return DP(d.k + 1, d.p);
};

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

int main() {

  cin >> N;

  init_fact(N, MOD);

  Rerooting<DP> rr(N, my_identity, my_merge, my_add_root);
  REP(i, N - 1) {
    int a, b;
    cin >> a >> b;
    rr.add_edge(a - 1, b - 1);
  }

  rr.build();
#if DEBUG
  rr.dump();
#endif

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


Measured memory_bytes: 54128