#pragma GCC optimize("Ofast")
#pragma GCC target ("avx")

#include <stdio.h>
#include <utility>

// 入力
constexpr unsigned int MAX_INPUT_SIZE = 2'800'334 - 111205; //'
char Input[MAX_INPUT_SIZE];
char* input = Input;
char* output = Input;
inline unsigned int get(void){
    unsigned long long int res = *(unsigned long long int*)input; // リトルエンディアン
    const unsigned int a = __builtin_ctzll((res & 0x1010101010101010) ^ 0x1010101010101010); // 左にビット寄せ
    input += (a + 4) >> 3;
    res = (res << (68 - a)) & 0x0f0f0f0f0f0f0f0f;
    res = (res * 10 + (res >> 8)) & 0x00ff00ff00ff00ff;
    res = (res * 100 + (res >> 16)) & 0x0000ffff0000ffff;
    res = (res * 10000 + (res >> 32)) & 0x00000000ffffffff;
    return res;
}
// 出力

constexpr unsigned int digit = 5;
constexpr unsigned int MAX_D_SIZE = 100'000; //'
struct NoName{
    struct Mike{
        unsigned long long int str;
        char dig;
    };
    Mike S[MAX_D_SIZE];
    unsigned long long int T[MAX_D_SIZE];
    constexpr NoName(void): S(), T(){
        char P[8]{}, Q[8]{};
        for(unsigned int i = 0; i < MAX_D_SIZE; ++i){
            unsigned int t = i;
            char* ptr = P;
            while(t){ S[i].dig++; *(ptr++) = '0' ^ (t % 10); t /= 10; }
            for(unsigned int j = 0, j2 = digit - 1; j < digit; ++j, --j2){
                Q[j2] = P[j] ? P[j] : '0';
            }
            --ptr; char* ptr2 = P;
            while(ptr2 < ptr){
                const char c = *ptr; 
                *(ptr--) = *ptr2; *(ptr2++) = c;
            }
            for(unsigned int j1  = 0, j2 = 0; j1 < 5; ++j1, j2 += 8){
                S[i].str |= (unsigned long long int)(P[j1]) << j2; P[j1] = 0;
                T[i]     |= (unsigned long long int)(Q[j1]) << j2; Q[j1] = 0;
            }
        }
    }
};
constexpr NoName Da;

inline void writeBuffer(unsigned int n){
    if(n < MAX_D_SIZE){
        *(unsigned long long int*)(output) = Da.S[n].str;
        output += Da.S[n].dig;
    }
    else{
        const unsigned int s = n / MAX_D_SIZE, t = n % MAX_D_SIZE;
        *(unsigned long long int*)(output) = Da.S[s].str;
        output += Da.S[s].dig;
        *(unsigned long long int*)(output) = Da.T[t];
        output += 5;
    }    
    *(output++) = '\n';
}

// 制約
constexpr unsigned int MAX_N = 200'000; //'
constexpr unsigned int mod = 1'000'000'007; //'

// 階乗計算
template <const unsigned int M> struct shuumai {
public:
    unsigned long long int P[M + 1];
    unsigned long long int Inv[M + 1];
    unsigned long long int inv[M + 1];
    constexpr shuumai(void):P(), Inv(), inv(){
        P[0] = 1; P[1] = 1;
        for(unsigned int x = 1, y = 2; x < M; ++x, ++y) P[y] = (P[x] * y) % mod;
        Inv[M] = inverse(P[M]);
        for(unsigned int x = M, y = M - 1; x ; --x, --y){
            Inv[y] = (Inv[x] * x) % mod;
            inv[x] = (P[y] * Inv[x]) % mod;
        }
        inv[0] = 1;
    }
    constexpr unsigned int inverse(unsigned int a) const noexcept {
        unsigned int b = mod;
                 int u = 1, v = 0;
        while (b) {
            unsigned int t = a / b; 
            a -= t * b; { const unsigned int tmp = a; a = b; b = tmp; }
            u -= t * v; { const unsigned int tmp = u; u = v; v = tmp; }
        }
        if(u < 0) u += mod;
        return u;
    }
};
constexpr shuumai<MAX_N> karashi;

// リスト
struct Node{
    unsigned int vertex;
    unsigned int next;
};
Node node[2 * MAX_N];
unsigned int begin[MAX_N];
unsigned int end = 1;
inline void append(const unsigned int u, const unsigned v){
    node[end] = {v, begin[u]}; begin[u] = end++;
    node[end] = {u, begin[v]}; begin[v] = end++;
}

// 擬似stack
unsigned int Stack[MAX_N];
unsigned int index_stack = 0;

inline void push(const unsigned int value){ Stack[index_stack++] = value; }
inline unsigned int top(void){ return Stack[--index_stack];}
inline bool exist(void){ return index_stack; }

// 
bool visited[MAX_N];
unsigned int parent[MAX_N];
unsigned int order[MAX_N];
unsigned int index_order = 0;


unsigned int subTree[MAX_N];
unsigned int dp[MAX_N];

int main(void){
    fread_unlocked(Input, sizeof(char), MAX_INPUT_SIZE, stdin);
    const unsigned int n = get();

    for(unsigned int _ = 1; _ < n; ++_) append(get() - 1, get() - 1);
    // DFSの順序決め
    push(0); visited[0] = true; order[index_order++] = 0;
    while(exist()){
        const unsigned int v = top();
        for(unsigned int idx = begin[v]; idx ; idx = node[idx].next){
            const unsigned int nv = node[idx].vertex;
            if(not visited[nv]){ 
                visited[nv] = true; 
                parent[index_order] = v; 
                order[index_order++] = nv; push(nv);  
            }
        }
    }

    for(unsigned int i = 0; i < n; ++i) dp[i] = 1;
    // 根からボトムアップにdp値を計算
    for(unsigned int i = n - 1; i ; --i){
        const unsigned int v = order[i];
        const unsigned int nv = parent[i];
        dp[v] = dp[v] * karashi.P[subTree[v]++] % mod;
        dp[nv] = dp[nv] * (dp[v] * karashi.Inv[subTree[v]] % mod) % mod;
        subTree[nv] += subTree[v];
    }

    {
        dp[0] = dp[0] * karashi.P[subTree[0]++] % mod;
    }


    for(unsigned int i = 1; i < n; ++i){
        const unsigned int v = order[i];
        const unsigned int nv = parent[i];
        dp[v] = dp[nv] * (subTree[v] * karashi.inv[n - subTree[v]] % mod) % mod;
    }

    // 出力
    for(unsigned int i = 0; i < n; ++i) writeBuffer(dp[i]);
    *output = '\0';
    fwrite_unlocked(Input, sizeof(char), output - Input, stdout);
    return 0;
}

Measured memory_bytes: 12800