#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define abdelrahman010 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
using namespace std;
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
int n , sz[N] , dp[N] , ans[N];
vector<int> v1[N] , pref[N];
deque<int> suf[N] , v2[N];
vector<int> g[N];
int fact[N] , inv[N];
int fp(int x , int y) {
    if(!y)
        return 1;
    int res = fp(x , y / 2);
    res = (1ll * res * res) % mod;
    if(y & 1)
        res = (1ll * res * x) % mod;
    return res;
}
void pre() {
    fact[0] = inv[0] = 1;
    for(int i = 1;i < N;i++) {
        fact[i] = (1ll * fact[i - 1] * i) % mod;
        inv[i] = fp(fact[i] , mod - 2);
    }
}
int ncr(int n , int r) {
    return (1ll * (1ll * fact[n] * inv[r]) % mod * inv[n - r]) % mod;
}
void dfs(int node , int par) {
    dp[node] = 1;
    for(auto &i : g[node])
        if(i != par) {
            dfs(i , node);
            dp[node] = (1ll * dp[node] * dp[i]) % mod;
            dp[node] = (1ll * dp[node] * ncr(sz[node] + sz[i] , sz[i])) % mod;
            sz[node] += sz[i];
        }
    sz[node]++;
    int k = g[node].size();
    int a1 = 1 , b1 = 0 , a2 = 1 , b2 = 0;
    for(int i = 0 , j = k - 1;i < k;i++ , j--) {
        int u = g[node][i] , v = g[node][j];
        if(u != par) {
            a1 = (1ll * a1 * dp[u]) % mod;
            a1 = (1ll * a1 * ncr(b1 + sz[u] , sz[u])) % mod;
            b1 += sz[u];
        }
        if(v != par) {
            a2 = (1ll * a2 * dp[v]) % mod;
            a2 = (1ll * a2 * ncr(b2 + sz[v] , sz[v])) % mod;
            b2 += sz[v];
        }
        pref[node].push_back(a1);
        v1[node].push_back(b1);
        suf[node].push_front(a2);
        v2[node].push_front(b2);
    }
}
void solve(int node , int par) {
    ans[node] = dp[node];
    for(int i = 0;i < g[node].size();i++) {
        int u = g[node][i];
        if(u != par) {
            int dp1 = dp[node] , dp2 = dp[u];
            int sz1 = sz[node] , sz2 = sz[u];
            sz[node] = 0;
            dp[node] = max(1 , dp[par]);
            dp[node] = (1ll * dp[node] * ncr(sz[par] + sz[node] , sz[par])) % mod;
            sz[node] += sz[par];
            if(i) {
                dp[node] = (1ll * dp[node] * pref[node][i - 1]) % mod;
                dp[node] = (1ll * dp[node] * ncr(sz[node] + v1[node][i - 1] , sz[node])) % mod;
                sz[node] += v1[node][i - 1];
            }
            if(i < suf[node].size() - 1) {
                dp[node] = (1ll * dp[node] * suf[node][i + 1]) % mod;
                dp[node] = (1ll * dp[node] * ncr(sz[node] + v2[node][i + 1] , sz[node])) % mod;
                sz[node] += v2[node][i + 1];
            }
            sz[node]++ , sz[u]--;
            dp[u] = (1ll * dp[u] * dp[node]) % mod;
            dp[u] = (1ll * dp[u] * ncr(sz[node] + sz[u] , sz[u])) % mod;
            sz[u] += sz[node] + 1;
            solve(u , node);
            dp[node] = dp1 , dp[u] = dp2;
            sz[node] = sz1 , sz[u] = sz2;
        }
    }
}
int main() {
    abdelrahman010
    cin >> n;
    pre();
    for(int i = 1;i < n;i++) {
        int u , v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    dfs(1 , 1);
    solve(1 , 0);
    for(int i = 1;i <= n;i++)
        cout << ans[i] << '\n';
    return 0;
}

Measured memory_bytes: 518388