// g++ -std=c++14

/*

Today might be the chance to grasp the chance to let your talent bloom.
May be tomorrow, the day after, or next year...
May be even when you are 30. I'm not sure if physique has anything to do with it
but if you think that it will never come, it probably never will.

- Tooru Oikawa.

*/


#include<bits/stdc++.h>

typedef long long ll;
typedef long double lld;
using namespace std;

#define endl "\n"
#define fi first
#define se second
#define MEMS(a,b) memset(a,b,sizeof(a))
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define all(c) c.begin(),c.end()
#define pii pair<int, int>

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r)
{
	uniform_int_distribution<int> uid(l, r);
	return uid(rng);
}

#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)
template<typename S, typename T>
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.fi<<", "<<p.se<<')';return out;}

template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
ll l=v.size();for(ll i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}

template <typename T>
ostream &operator<<(ostream &out, set<T> const &v) {
    for (auto i = v.begin(); i != v.end(); i++)
        out << (*i) << ' ';
    return out;
}
template <typename T>
ostream &operator<<(ostream &out, multiset<T> const &v) {
    for (auto i = v.begin(); i != v.end(); i++)
        out << (*i) << ' ';
    return out;
}
template <typename T, typename V>
ostream &operator<<(ostream &out, map<T, V> const &v) {
    for (auto i = v.begin(); i != v.end(); i++)
        out << "\n" << (i->first) <<  ":"  << (i->second);
    return out;
}

template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}

template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}

#define int ll

const int N = 4e5 + 190;
const int MOD = 1e9 + 7;

int fac[N + 10], ifac[N + 10];

int power(int x, int t){
    int ans = 1;
    while(t > 0) {
        if(t & 1) ans = 1LL * ans * x % MOD;
        x = 1LL * x * x % MOD;
        t >>= 1;
    }
    return ans;
}

void init_fac(){
    fac[0] = 1;
    for(int i = 1; i < N; i++){
        fac[i] = (fac[i - 1] * i) % MOD;
    }
    ifac[N - 1] = power(fac[N - 1], MOD - 2);
    for(int i = N - 1; i >= 1; i--){
        ifac[i - 1] = (ifac[i] * i) % MOD;
    }
}

int C(int n, int m)
{
	if(n < m) return 0;
	return fac[n] * (1LL * ifac[m] * ifac[n - m] % MOD) % MOD;
}

int n;
vector<vector<int>> g(N);

int sub[N];
int dp[N];

int ans[N];

void dfs0(int v, int p) {
    sub[v]++;
    for (auto u : g[v]) {
        if (u == p) continue;
        dfs0(u, v);
        sub[v] += sub[u];
    }
}

void dfs1(int v, int p) {
    dp[v] = 1;
    int cnt = 0;
    for (auto u : g[v]) {
        if (u == p) continue;
        dfs1(u, v);
        int tot = cnt + sub[u];
        int val = (C(tot, sub[u]) * dp[u]) % MOD;
        dp[v] = (dp[v] * val) % MOD;
        cnt = tot;
    }
}

void dfs2(int v, int p, int v2, int cnt) {
    ans[v] = v2;
    int c2 = cnt;
    for (auto u : g[v]) {
        if (u == p) continue;
        int tot = c2 + sub[u];
        int val = (C(tot, sub[u]) * dp[u]) % MOD;
        ans[v] = (ans[v] * val) % MOD;
        c2 = tot;
    }
    // tr(v, ans[v], v2, cnt, p, c2);
    int right = ans[v], left = 1;
    int c1 = 0;
    int v1 = 1;

    for (auto u : g[v]) {
        if (u == p) continue;
        right = (right * power(dp[u], MOD - 2)) % MOD;
        int vvv = C(c2, sub[u]);
        right = (right * power(vvv, MOD - 2)) % MOD;
        c2 -= sub[u];

        int ways = C(c1 + c2, c1);
        ways = (ways * ((v1 * right) % MOD)) % MOD;
        dfs2(u, v, ways, c1 + c2 + 1);

        int temp = (C(c1 + sub[u], sub[u]) * dp[u]) % MOD;
        v1 = (v1 * temp) % MOD;
        c1 += sub[u];
    }

}

int solve() {
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        int v, u;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    dfs0(1, 0);
    dfs1(1, 0);
    dfs2(1, 0, 1, 0);
    for (int i = 1; i <= n; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}

int32_t main(){ _
    init_fac();
    int t;
    // cin >> t;
    t = 1;
    while (t--) solve();
}


Measured memory_bytes: 34544