#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

// copied from https://atcoder.jp/contests/abc160/submissions/11278548

template<unsigned MOD_> struct ModInt {
    static constexpr unsigned MOD = MOD_;
    unsigned x;
    void undef() { x = (unsigned)-1; }
    bool isnan() const { return x == (unsigned)-1; }
    inline int geti() const { return (int)x; }
    ModInt() { x = 0; }
    ModInt(const ModInt &y) { x = y.x; }
    ModInt(int y) { if (y<0 || (int)MOD<=y) y %= (int)MOD; if (y<0) y += MOD; x=y; }
    ModInt(unsigned y) { if (MOD<=y) x = y % MOD; else x = y; }
    ModInt(long long y) { if (y<0 || MOD<=y) y %= MOD; if (y<0) y += MOD; x=y; }
    ModInt(unsigned long long y) { if (MOD<=y) x = y % MOD; else x = y; }
    ModInt &operator+=(const ModInt y) { if ((x += y.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator-=(const ModInt y) { if ((x -= y.x) & (1u<<31)) x += MOD; return *this; }
    ModInt &operator*=(const ModInt y) { x = (unsigned long long)x * y.x % MOD; return *this; }
    ModInt &operator/=(const ModInt y) { x = (unsigned long long)x * y.inv().x % MOD; return *this; }
    ModInt operator-() const { return (x ? MOD-x: 0); }
 
    ModInt inv() const { return pow(MOD-2); }
    ModInt pow(long long y) const {
	ModInt b = *this, r = 1;
	if (y < 0) { b = b.inv(); y = -y; }
	for (; y; y>>=1) {
	    if (y&1) r *= b;
	    b *= b;
	}
	return r;
    }
 
    friend ModInt operator+(ModInt x, const ModInt y) { return x += y; }
    friend ModInt operator-(ModInt x, const ModInt y) { return x -= y; }
    friend ModInt operator*(ModInt x, const ModInt y) { return x *= y; }
    friend ModInt operator/(ModInt x, const ModInt y) { return x *= y.inv(); }
    friend bool operator<(const ModInt x, const ModInt y) { return x.x < y.x; }
    friend bool operator==(const ModInt x, const ModInt y) { return x.x == y.x; }
    friend bool operator!=(const ModInt x, const ModInt y) { return x.x != y.x; }
};

constexpr ll MOD = 1000000007;
using Mint = ModInt<MOD>;



template<unsigned MOD_>
struct ModComb{
    int maximum;
    int mod;
    vector<ModInt<MOD_>> inv;
    vector<ModInt<MOD_>> fact;
    vector<ModInt<MOD_>> fact_inv;
    ModComb(){
        //pass
    };
    ModComb(int max_):maximum(max_),inv(max_),fact(max_),fact_inv(max_){
        fact[0] = 1;
        for (int i=1; i<maximum; i++) fact[i] = fact[i-1] * i;
        fact_inv[maximum-1] = fact[maximum-1].inv();
        for (int i=maximum-2; i>=0; i--) fact_inv[i] = fact_inv[i+1] * (i+1);
        inv[0] = 0;
        for (int i=1; i<maximum; i++) inv[i] = fact_inv[i] * fact[i-1];
    };
    ModInt<MOD_> operator()(int n, int k){
        return fact[n] * fact_inv[k] * fact_inv[n-k];
    }

};



ModComb<MOD> comb;

 
struct Seg {
    int sz;
    Mint val;
    Seg(int v=1) {
	val=v; sz=0;
    }
    Seg inc(int id) const {
	Seg z = *this;
	z.sz++;
	return z;
    }
};//szとvalを保存する。incでszが増えたものが返り、足し算をすると、サイズを合算したものと、

Seg operator+(const Seg &x, const Seg &y) {
    Seg z;
    z.sz = x.sz + y.sz;
    z.val = comb(x.sz + y.sz, x.sz) * x.val * y.val;
    return z;//merge操作
}



void solve(long long N, std::vector<long long> a, std::vector<long long> b){
    comb = ModComb<MOD>(200011);
    vector<vector<int>> graph(N);
    for (int i=0;i<N-1;i++){
        graph[a[i]-1].push_back(b[i]-1);
        graph[b[i]-1].push_back(a[i]-1);
    }
    vector<int> ord;
    ord.clear();ord.reserve(N);//N要素の挿入が分かっているのであらかじめメモリを確保
    ord.push_back(0);
    vector<vector<Seg>> L(N);
    vector<vector<Seg>> R(N);
    vector<Seg> up(N);
    vector<Seg> down(N);
    vector<Seg> ans(N);
    for (int i=0;i<N;i++){
        int v = ord[i];
        for (const int e: graph[v]){
            ord.push_back(e);
            graph[e].erase(remove(graph[e].begin(),graph[e].end(),v),graph[e].end()) ;//各ノードを取り除き、メモリを切り詰める
            // child ->parent方向の枝を削除している。
            //特定要素を取り除くテクニックhttps://ox8000ffff.hatenadiary.org/entry/20100322/1269268470
        }
    }
    //ついでにordは0の子を根から順に突っ込んだ配列になっている
    for (int i=0;i<N;i++){
        int v = ord[N-1- i];//逆向きにたどる
        int m = graph[v].size();//子の数
        L[v].assign(m+1,Seg());
        R[v].assign(m+1,Seg());
        for (int i=0;i <m;i++){
            L[v][i+1] = L[v][i] + up[graph[v][i]];
        }
	    
        for (int i=m; i--; ){
            R[v][i] = up[graph[v][i]] + R[v][i+1];
        }
        up[v] = R[v][0].inc(v); // up[v] = L[v].all + v own, |sz[v]|;
    }
    down[ord[0]] =Seg();
    for (int i=0;i<N;i++){
        int v = ord[i];
        ans[v] = (R[v][0] + down[v]).inc(v);
        for (int j =0; j<graph[v].size();j++){
            int w = graph[v][j];
            down[w] = (R[v][j+1] + down[v] + L[v][j]).inc(v);
        }
    }
    for (int i= 0;i<N;i++){
        printf("%d\n", ans[i].val.geti());
    }




}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N-1);
    std::vector<long long> b(N-1);
    for(int i = 0 ; i < N-1 ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
    }
    solve(N, std::move(a), std::move(b));
    return 0;
}


Measured memory_bytes: 49908