#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

const int mod = 1000000007; // 998244353;
struct mint {
  long long x;
  mint(long long 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(long long 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(200009);

struct Rerooting {
  struct DP {
    mint dp;
    int t;
    DP(int dp=1, int t=0) : dp(dp), t(t) {}
    DP operator+(const DP& a) const {
      DP res(*this);
      res.dp *= a.dp;
      res.t += a.t;
      res.dp *= comb(res.t, a.t);
      return res;
    }
    DP add_root() const {
      DP res(*this);
      res.t++;
      return res;
    }
  };

  int n;
  vector<vector<int>> to;
  vector<vector<DP>> dp;
  vector<DP> ans;
  Rerooting(int n) : n(n), to(n), dp(n), ans(n) {}
  void add_edge(int s, int t) {
    to[s].push_back(t);
  }
  void init() {
    dfs(0);
    bfs(0);
  }

  DP dfs(int v, int p=-1) {
    DP dp_sum;
    dp[v] = vector<DP>(to[v].size());
    for (int i = 0; i < to[v].size(); i++) {
      int u = to[v][i];
      if (u == p) continue;
      dp[v][i] = dfs(u, v);
      dp_sum = dp_sum + dp[v][i];
    }
    return dp_sum.add_root();
  }
  void bfs(int v, const DP& dp_p=DP(), int p=-1) {
    int deg = to[v].size();
    for (int i = 0; i < deg; i++) {
      if (to[v][i] == p) dp[v][i] = dp_p;
    }

    vector<DP> dp_l(deg+1), dp_r(deg+1);
    for (int i = 0; i < deg; i++) {
      dp_l[i+1] = dp_l[i] + dp[v][i];
    }
    for (int i = deg-1; i >= 0; i--) {
      dp_r[i] = dp_r[i+1] + dp[v][i];
    }
    ans[v] = dp_l[deg].add_root();

    for (int i = 0; i < deg; i++) {
      int u = to[v][i];
      if (u == p) continue;
      DP d = dp_l[i] + dp_r[i+1];
      bfs(u, d.add_root(), v);
    }
  }
};

int main(){
  int n;
  cin>>n;
  Rerooting t(n);
  rep(i,n-1){
    int a,b;
    cin>>a>>b;
    a--;b--;
    t.add_edge(a,b);
    t.add_edge(b,a);
  }
  t.init();
  rep(i,n){
    cout<<t.ans[i].dp<<endl;
  }
  return(0);
}


Measured memory_bytes: 38516