#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;

constexpr int mod = 1000000007;
constexpr int MAX_N = 200005;
struct mint {
  ll x; // typedef long long ll;
  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;}
// combination mod prime

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} comb(MAX_N);

template <typename T> 
struct Rerooting {
  int n;
  vector<vector<int>> g;

  struct DP {
    T dp;
    int t;
    DP (T dp = 1, int t = 0):dp(dp),t(t) {}
    DP operator+(const DP& a) const {
      return DP(dp*a.dp*comb(t+a.t, t), t+a.t);
    }
    DP addRoot() const {
      return DP(dp, t+1);
    }
  };

  vector<vector<DP>> dp;
  vector<DP> res;

  Rerooting(int sz) {
    n = sz;
    g.resize(n);
    dp.resize(n);
    res.resize(n);
  }

  void add_edge(int u, int v) {
    g[u].emplace_back(v);
    g[v].emplace_back(u);
  }

  DP dfs1 (int u, int p = -1) {
    DP dpcum;
    dp[u] = vector<DP>(g[u].size());
    for (int i = 0; i < g[u].size(); i++) {
      int v = g[u][i];
      if (v == p) continue;
      dp[u][i] = dfs1(v, u);
      dpcum = dpcum + dp[u][i];
    }
    return dpcum.addRoot();
  }

  void dfs2 (int u, const DP& dpar = DP(), int p = -1) {
    int deg = g[u].size();
    for (int i = 0; i < deg; i++) if (g[u][i] == p) dp[u][i] = dpar;
    
    vector<DP> dpleft(deg+1);
    for (int i = 0; i < deg; i++) dpleft[i + 1] = dpleft[i] + dp[u][i];

    vector<DP> dpright(deg+1);
    for (int i = deg-1; i >= 0; i--) dpright[i] = dpright[i + 1] + dp[u][i];

    res[u] = dpleft[deg].addRoot();

    for (int i = 0; i < deg; i++) {
      int v = g[u][i];
      if (v == p) continue;
      DP d = dpleft[i] + dpright[i + 1];
      dfs2(v, d.addRoot(), u);
    }
  }

  void build(int root = 0) {
    dfs1(root);
    dfs2(root);
  }

  T ans(int i) {
    return res[i].dp;
  }
};

int main(){
  int n;
  cin >> n;
  Rerooting<mint> dp(n);
  for (int i = 0; i < n-1; i++) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    dp.add_edge(a, b);
  }
  dp.build();
  for (int i = 0; i < n; i++) cout << dp.ans(i) << endl;
  return 0;
} 

Measured memory_bytes: 38516