#include <cassert>
#include <iostream>
#include <vector>
using namespace std;

template<long long mod>
class modint{
private:
  long long a;
public:
  constexpr modint(const long long x = 0) noexcept : a(x%mod) {}
  constexpr long long& value() noexcept { return a; }
  constexpr const long long& value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint& operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if(a >= mod) a -= mod;
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if(a < rhs.a) a += mod;
    a -= rhs.a;
    return *this;
  }
  constexpr modint& operator*=(const modint rhs) noexcept {
    a = a*rhs.a%mod;
    return *this;
  }
  constexpr modint& operator/=(modint rhs) noexcept {
    long long k = mod-2;
    while(k > 0){
      if(k&1){
        *this *= rhs;
      }
      rhs *= rhs;
      k /= 2;
    }
    return *this;
  }
  friend ostream& operator<<(ostream &os, const modint &X){
    return os << X.a;
  }
  friend istream& operator>>(istream &is, modint &X){
    is >> X.a;
    X.a %= mod;
    if(X.a < 0) X.a += mod;
    return is;
  }
};


template<typename T>
struct Combination {
private:
  int sz;
  vector<T> F, F_;
public:
  Combination(int sz) : sz(sz), F(sz+1), F_(sz+1) {
    F[0] = 1;
    for(int i = 0; i < sz; ++i) F[i+1] = F[i]*(i+1);
    F_.back() = (T)1/F.back();
    for(int i = sz-1; i >= 0; --i) F_[i] = F_[i+1]*(i+1);
  }
  T C(int n, int k){
    assert(n <= sz);
    if(n < 0 or k > n) return (T)0;
    return F[n]*F_[k]*F_[n-k];
  }
};

using mint = modint<(int)1e9+7>;

Combination<mint> comb(2e5+100);

pair<int,mint> dfs(const vector<vector<int>> &G, int v, int p, vector<pair<int,mint>>& S){
  int sz = 1;
  mint t = 1;
  vector<int> T;
  for(auto v_ : G[v]){
    if(v_ == p) continue;
    auto r = dfs(G,v_,v,S);
    sz += r.first;
    T.push_back(r.first);
    t *= r.second;
  }
  int sz_ = sz - 1;
  for(auto e : T){
    t *= comb.C(sz_,e);
    sz_ -= e;
  }
  S[v] = {sz,t};
  return S[v];
}

void dfs2(const vector<vector<int>> &G, int v, int p, const vector<pair<int,mint>>& S, vector<mint> &A, pair<int,mint> pp){
  size_t n = G[v].size();
  vector<pair<int,mint>> T; 
  for(auto v_ : G[v]){
    pair<int,mint> r;
    if(v_ == p) r = pp;
    else r = S[v_];
    T.push_back(r);
  }
  vector<pair<int,mint>> F(n+1), B(n+1);
  F[0] = {0,1};
  for(size_t i = 1; i < F.size(); ++i){
    assert(i-1 < T.size());
    F[i].first = F[i-1].first+T[i-1].first;
    F[i].second = F[i-1].second*comb.C(F[i].first,F[i-1].first)*T[i-1].second;
  }
  A[v] = F.back().second;
  // cerr << v << " " << A[v] << endl;
  B.back() = {0,1};
  for(size_t i = B.size()-1; i > 0; --i){
    B[i-1].first = B[i].first+T[i-1].first;
    B[i-1].second = B[i].second*comb.C(B[i-1].first,B[i].first)*T[i-1].second;
  }

  for(size_t i = 0; i < n; ++i){
    int v_ = G[v][i];
    if(v_ == p) continue;
    int s = F[i].first+B[i+1].first;
    mint t = F[i].second*B[i+1].second*comb.C(s,F[i].first);
    ++s;
    // cerr << v << " " << v_ << " " << s << " " << t << endl;
    dfs2(G,v_,v,S,A,{s,t});
  }
}

int main(){
  int N;
  cin >> N;
  vector<vector<int>> G(N);
  for(int i = 0; i < N-1; ++i){
    int a, b;
    cin >> a >> b;
    --a,--b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  vector<pair<int,mint>> S(N);
  auto r = dfs(G,0,-1,S);
  // cout << r.second << endl;
  vector<mint> A(N);
  dfs2(G,0,-1,S,A,{0,1});
  for(auto a : A)
    cout << a << endl;
}


Measured memory_bytes: 29920