#include <bits/stdc++.h>

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

template <typename T>
std::tuple<T, T, T> extgcd(T a, T b){
    T s1 = 1, t1 = 0, s2 = 0, t2 = 1;
    while(b != 0){
        std::tie(s1, t1, s2, t2) = std::make_tuple(s2, t2, s1 - (a / b) * s2, t1 - (a / b) * t2);
        std::tie(a, b) = std::make_tuple(b, a % b);
    }
    return std::make_tuple(s1, t1, a);
}

template <typename T>
T mod_inverse(T a, T mod){
    T b;
    std::tie(b, std::ignore, std::ignore) = extgcd(a, mod);
    if(b < 0){b += mod;}
    return b;
}

template <typename T>
struct Combinatorics{
    T modulo;
    std::vector<T> fact, inv_fact;

    Combinatorics(T max, T modulo) : modulo(modulo), fact(max + 1), inv_fact(max + 1) {
        fact[0] = 1;
        for(T i=1;i<=max;++i){
            fact[i] = i * fact[i - 1] % modulo;
        }

        inv_fact[max] = mod_inverse(fact[max], modulo);
        for(T i=max;i>0;--i){
            inv_fact[i - 1] = i * inv_fact[i] % modulo;
        }
    }

    T nPk(T n, T k){
        if(n < k){return 0;}
        return fact[n] * inv_fact[n - k] % modulo;
    }

    T nCk(T n, T k){
        if(n < k){return 0;}
        return fact[n] * inv_fact[k] % modulo * inv_fact[n - k] % modulo;
    }

    T nHk(T n, T k){
        if(n == 0 && k == 0){return 1;}
        return nCk(n + k - 1, k);
    }
};

constexpr ll MOD = 1'000'000'007;
int N;
std::vector<int> G[200100];
int pi[200100];
std::vector<ll> si[200100], dp[200100];
Combinatorics<ll> comb(200100, MOD);
ll res[200100];

int dfs1(int v, int p){
    si[v].resize(G[v].size());

    int res = 1;

    for(int i=0;i<G[v].size();++i){
        int w = G[v][i];

        if(w == p){
            pi[v] = i;
            continue;
        }

        si[v][i] = dfs1(w, v);
        res += si[v][i];
    }

    if(p != -1){
        si[v][pi[v]] = N - res;
    }

    return res;
}

ll dfs2(int v, int p){
    dp[v].resize(G[v].size());

    ll res = 1;
    int x = 0;

    for(int i=0;i<G[v].size();++i){
        int w = G[v][i];

        if(w == p){
            continue;
        }

        x += si[v][i];

        dp[v][i] = dfs2(w, v);

        res = res * dp[v][i] % MOD;
        res = res * comb.inv_fact[si[v][i]] % MOD;
    }

    res = res * comb.fact[x] % MOD;

    return res;
}

void dfs3(int v, int p, ll other){
    if(p != -1){
        dp[v][pi[v]] = other;
    }

    int deg = G[v].size();
    std::vector<ll> dpl(deg + 1), dpr(deg + 1);

    dpl[0] = 1;

    for(int i=0;i<deg;++i){
        dpl[i+1] = dpl[i] * dp[v][i] % MOD * comb.inv_fact[si[v][i]] % MOD;
    }
    
    dpr[deg] = 1;

    for(int i=deg-1;i>=0;--i){
        dpr[i] = dpr[i+1] * dp[v][i] % MOD * comb.inv_fact[si[v][i]] % MOD;
    }

    res[v] = dpr[0] * comb.fact[N-1] % MOD;

    for(int i=0;i<deg;++i){
        int w = G[v][i];

        if(w == p){continue;}

        dfs3(w, v, dpl[i] * dpr[i+1] % MOD * comb.fact[N - si[v][i] - 1] % MOD);
    }
}

int main(){
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  std::cin >> N;

  for(int i=0;i<N-1;++i){
      int a, b;
      std::cin >> a >> b;

      G[a].emplace_back(b);
      G[b].emplace_back(a);
  }

  dfs1(1, -1);
  dfs2(1, -1);
  dfs3(1, -1, 0);

  for(int i=1;i<=N;++i){
      std::cout << res[i] << std::endl;
  }
}


Measured memory_bytes: 45556