#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long FINV(int n){
    if (n < 0) return 0;
    return finv[n];
}

#define MAX_N 200005
vector<int> pre_G[MAX_N];
vector<int> G[MAX_N];
int par_[MAX_N];
int flag_netsukigi[MAX_N];
void make_netsukigi(int r){
    queue<int> que;
    que.push(r);
    flag_netsukigi[r] = 1;
    par_[r] = -1;

    while(que.size() > 0){
        int x = que.front();
        que.pop();
        flag_netsukigi[x] = 1;
        rep(i,pre_G[x].size()){
            if(flag_netsukigi[pre_G[x][i]] == 0){
                par_[pre_G[x][i]] = x;
                G[x].push_back(pre_G[x][i]);
                que.push(pre_G[x][i]);
            }
        }
    }
}

// ax + by = gcd(a, b) となるような (x, y) を求める
// 多くの場合 a と b は互いに素として ax + by = 1 となる (x, y) を求める
long long extGCD(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a%b, y, x); // 再帰的に解く
    y -= a / b * x;
    return d;
}

// 負の数にも対応した mod (a = -11 とかでも OK) 
inline long long mod(long long a, long long m) {
    return (a % m + m) % m;
}

// 逆元計算 (ここでは a と m が互いに素であることが必要)
long long modinv(long long a, long long m) {
    long long x, y;
    extGCD(a, m, x, y);
    return mod(x, m); // 気持ち的には x % m だが、x が負かもしれないので
}


int main() {
    int n;
    cin >> n;

    COMinit();

    rep(i,n-1){
        int a, b;
        scanf("%d%d", &a, &b);
        a--; b--; // 0-indexにするため.
        pre_G[a].push_back(b);
        pre_G[b].push_back(a);
    }

    make_netsukigi(0);
    int cnt[n];
    ll ans[n] = {};
    vector<P> v[n];
    ll sum[n] = {};
    ll tmp[n] = {};

    queue<int> que;
    rep(i,n){
        cnt[i] = G[i].size();
        if(G[i].size() == 0){
            que.push(i);
        }
    }

    while(que.size()){
        int x = que.front();
        que.pop();
        sum[x] = 1;
        tmp[x] = 1;
        rep(i,v[x].size()){
            sum[x] += v[x][i].first;
        }
        tmp[x] = fac[sum[x]-1];
        rep(i,v[x].size()){
            tmp[x] *= finv[v[x][i].first];
            tmp[x] %= MOD;
            tmp[x] *= v[x][i].second;
            tmp[x] %= MOD;
        }

        if(x == 0){
            ans[0] = tmp[x];
            break;
        }

        v[par_[x]].push_back(P(sum[x], tmp[x]));
        cnt[par_[x]]--;
        if(cnt[par_[x]] == 0){
            que.push(par_[x]);
        }
    }

    // rep(i,n)cout << i << ' ' << sum[i] << ' ' << tmp[i] << endl;
    ll tmp2[n] = {};
    rep(i,G[0].size()){
        que.push(G[0][i]);
        tmp2[G[0][i]] = ans[0] * finv[n - 1] % MOD * fac[n - sum[G[0][i]] - 1] % MOD * fac[sum[G[0][i]]] % MOD * modinv(tmp[G[0][i]], MOD) % MOD; 
    }

    

    while(que.size()){
        int x = que.front();
        que.pop();
        
        ans[x] = fac[n - 1] * finv[n - sum[x]] % MOD * tmp2[x] % MOD;
        rep(i,v[x].size()){
            ans[x] = ans[x] * v[x][i].second % MOD * finv[v[x][i].first] % MOD;
        }
        

        rep(i,G[x].size()){
            que.push(G[x][i]);
            tmp2[G[x][i]] = ans[x] * finv[n - 1] % MOD * fac[n - sum[G[x][i]] - 1] % MOD * fac[sum[G[x][i]]]  % MOD * modinv(tmp[G[x][i]], MOD) % MOD;
        }
    }

    // rep(i,n)cout << i << ' ' << tmp2[i] << endl;
    
    rep(i,n)cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 52480