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

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

// 入力
constexpr int MAX_INPUT_SIZE = 2'800'334 - 111205; //'
char Input[MAX_INPUT_SIZE];
char* input = Input;
char* output = Input;
inline int get(void){
    long long int res = *(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 int digit = 5;
constexpr int MAX_D_SIZE = 100'000; //'
struct NoName{
    struct Mike{
        long long int str;
        int dig;
    };
    Mike S[MAX_D_SIZE];
    long long int T[MAX_D_SIZE];
    constexpr NoName(void): S(), T(){
        char P[8]{}, Q[8]{};
        for(int i = 0; i < MAX_D_SIZE; ++i){
            int t = i;
            char* ptr = P;
            while(t){ S[i].dig++; *(ptr++) = '0' ^ (t % 10); t /= 10; }
            for(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(int j1  = 0, j2 = 0; j1 < 5; ++j1, j2 += 8){
                S[i].str |= (long long int)(P[j1]) << j2; P[j1] = 0;
                T[i]     |= (long long int)(Q[j1]) << j2; Q[j1] = 0;
            }
        }
    }
};
constexpr NoName Da;

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

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

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

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

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

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

struct PO{
    int parent;
    int order;
};
PO holder[MAX_N];
int index_order = 1;

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

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

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

    // 根からボトムアップにdp値を計算
    for(int i = n - 1; i ; --i){
        const int v = holder[i].order;
        const int nv = holder[i].parent;
        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(int i = 1; i < n; ++i){
        const int v = holder[i].order;
        const int nv = holder[i].parent;
        dp[v] = dp[nv] * (subTree[v] * karashi.inv[n - subTree[v]] % mod) % mod;
    }

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


Measured memory_bytes: 12544