#include <iostream>
#include <vector>
#include <map>
#include <utility>
using namespace std;
#define ll long long int

const ll mod = 1e9 + 7;
const ll maxn = 2.2e5;

vector<ll> g[maxn];

bool used[maxn];

ll fac[maxn];
ll result[maxn];
map<pair<ll, ll>, ll> mp_sum;
map<pair<ll, ll>, ll> mp_mul;


ll _pow(ll a, ll b){
    // a^b
    a %= mod;
    if(b == 1){
        return a % mod;
    }
    ll half = _pow(a, b / 2);
    half *= half;
    half %= mod;
    if(b % 2 == 1){
        half *= a;
        half %= mod;
    }
    return (half % mod);
}
void init(){
    for(ll i = 0; i < maxn; ++i){
        used[i] = false;
    }
    fac[0] = 1;
    for(ll i = 1; i < maxn; ++i){
        fac[i] = fac[i - 1] * i;
        fac[i] %= mod;
    }
}
ll vec_sum(vector<ll> &v){
    ll sum = 0;
    for(ll i = 0; i < v.size(); ++i){
        sum += v[i];
    }
    return sum;
}
ll mul_calc(vector<ll> &child_cnt, vector<ll> &child_mul){
    ll ans = 1;
    for(ll i = 0; i < child_mul.size(); ++i){
        ans *= child_mul[i];
        ans %= mod;
    }
    ll all_cnt = vec_sum(child_cnt);
    all_cnt = fac[all_cnt];
    ans *= all_cnt;
    ans %= mod;
    ll down = 1;
    for(ll i = 0; i < child_cnt.size(); ++i){
        down *= fac[child_cnt[i]];
        down %= mod;
    }
    ans *= _pow(down, mod - 2);
    ans %= mod;
    return ans;
}
void dfs_mul_2(ll root){
    pair<ll, ll> p;
    used[root] = true;
    vector<ll> con = g[root];
    vector<ll> child_mul;
    vector<ll> child_cnt;
    for(ll i = 0; i < con.size(); ++i){
        ll child = con[i];
        p = make_pair(root, child);
        ll mul = mp_mul[p];
        ll cnt = mp_sum[p];
        child_mul.push_back(mul);
        child_cnt.push_back(cnt);
    }
    ll all_mul = mul_calc(child_cnt, child_mul);
    result[root] = all_mul;
    ll all_cnt = vec_sum(child_cnt);
    for(ll i = 0; i < con.size(); ++i){
        ll child = con[i];
        p = make_pair(child, root);
        ll val = ((all_mul * fac[child_cnt[i]]) % mod * (fac[all_cnt - child_cnt[i]])) % mod * _pow(fac[all_cnt] * child_mul[i], mod - 2);
        val %= mod;
        mp_mul[p] = val;
    }
    for(ll i = 0; i < con.size(); ++i){
        ll child = con[i];
        if(used[child] == false){
            dfs_mul_2(child);
        }
    }
    used[root] = false;
}
ll dfs_mul_1(ll root){
    pair<ll, ll> p;
    used[root] = true;
    vector<ll> con = g[root];
    vector<ll> child_mul;
    vector<ll> child_cnt;
    for(ll i = 0; i < con.size(); ++i){
        ll child = con[i];
        if(used[child] == false){
            ll mul = dfs_mul_1(child);

            p = make_pair(root, child);

            mp_mul[p] = mul;

            child_mul.push_back(mul);
            ll cnt = mp_sum[p];
            child_cnt.push_back(cnt);
        }
    }
    used[root] = false;
    ll all_mul = mul_calc(child_cnt, child_mul);
    return all_mul;
}
void dfs_sum_2(ll root){
    pair<ll, ll> p;
    used[root] = true;
    vector<ll> con = g[root];
    vector<ll> child_cnt;
    for(ll i = 0; i < con.size(); ++i){
        ll child = con[i];
        p = make_pair(root, child);
        ll cnt = mp_sum[p];
        child_cnt.push_back(cnt);
    }
    ll all_sum = vec_sum(child_cnt);
    for(ll i = 0; i < con.size(); ++i){
        ll child = con[i];
        p = make_pair(child, root);
        ll cnt = all_sum - child_cnt[i] + 1;
        mp_sum[p] = cnt;
    }
    for(ll i = 0; i < con.size(); ++i){
        ll child = con[i];
        if(used[child] == false){
            dfs_sum_2(child);
        }
    }
    used[root] = false;
}
ll dfs_sum_1(ll root){
    pair<ll, ll> p;
    used[root] = true;
    ll node_cnt = 1;
    vector<ll> con = g[root];
    vector<ll> child_cnt;
    for(ll i = 0; i < con.size(); ++i){
        ll child = con[i];
        if(used[child] == false){
            ll cnt = dfs_sum_1(child);
            p = make_pair(root, child);
            mp_sum[p] = cnt;
            child_cnt.push_back(cnt);
        }
    }
    used[root] = false;
    ll all_cnt = vec_sum(child_cnt);
    all_cnt++;
    return all_cnt;
}
int main(){
    ll n;
    cin >> n;
    for(ll i = 0; i < n - 1; ++i){
        ll a, b;
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    init();
    dfs_sum_1(1);
    // map<pair<ll, ll>, ll>::iterator it = mp_sum.begin();
    // while(it != mp_sum.end()){
    //     cout << it->first.first << " " << it->first.second << " " << it->second << endl;
    //     it++;
    // }
    // cout << endl;
    // cout << "OK1" << endl;
    dfs_sum_2(1);
    // cout << endl;
    // it = mp_sum.begin();
    // while(it != mp_sum.end()){
    //     cout << it->first.first << " " << it->first.second << " " << it->second << endl;
    //     it++;
    // }
    // cout << endl;
    // cout << "OK2" << endl;
    dfs_mul_1(1);
    // cout << endl;
    // map<pair<ll, ll>, ll>::iterator it = mp_mul.begin();
    // while(it != mp_mul.end()){
    //     cout << it->first.first << " " << it->first.second << " " << it->second << endl;
    //     it++;
    // }
    // cout << endl;
    // cout << "OK3" << endl;
    dfs_mul_2(1);
    // map<pair<ll, ll>, ll>::iterator it = mp_mul.begin();
    // while(it != mp_mul.end()){
    //     cout << it->first.first << " " << it->first.second << " " << it->second << endl;
    //     it++;
    // }
    // cout << endl;
    // cout << "OK4" << endl;
    for(ll i = 1; i <= n; ++i){
        cout << result[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 73784