//
// AtCoder Typical DP Contest. Problem N Tree
//

#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vector<int>>;
constexpr long long MOD = 1e9+7;

long long pow_mod(long long b, long long p, long long mod = 1'000'000'007){
    long long ret = 1;
    while (p){
        if (p & 1) ret = (ret * b) % mod;
        b = (b * b) % mod;
        p >>= 1;
    }
    return ret;
}

long long inv_mod(long long n, long long mod = 1'000'000'007){
    return pow_mod(n, mod - 2, mod);
}


class Solver{
    int N;
    vvi Es;
    vi euler_tour;
    vi n_child;
    vector<long long> dp;         //dp[v]: v を根とする部分木を、vを含む辺から始めて、常に辺が連結となるように描く順番が何通りあるか。
    vector<long long> ans;        //ans[v]: v を根とするときに、vを含む辺から始めて、常に辺が連結となるように描く順番が何通りあるか。
    int root;      //現時点の根
    vector<bool> visited;
    vector<long long> fac;
    vector<long long> invfac;

    void dfs(int v){
        euler_tour.push_back(v);
        visited[v] = true;
        long long num = 1;
        for (int u : Es[v]){
            if (visited[u]) continue;
            dfs(u);
            n_child[v] += n_child[u] + 1;
            num = (num * dp[u]) % MOD;
            num = (num * invfac[n_child[u] + 1]) % MOD;
            euler_tour.push_back(v);
        }
        num = (num * fac[n_child[v]]) % MOD;
        dp[v] = num;
    }

    void init(){
        for (long long i = 1; i <= N; ++i) fac[i] = (fac[i - 1] * i) % MOD;
        invfac[N] = pow_mod(fac[N], MOD - 2, MOD);
        for (long long i = N; i != 1; --i) invfac[i - 1] = (invfac[i] * i) % MOD;
        root = 0;
        dfs(root);
    }
    void swap_root(int old_root, int new_root){
        dp[old_root] = (dp[old_root] * inv_mod(dp[new_root])) % MOD;
        dp[old_root] = (dp[old_root] * fac[n_child[new_root] + 1]) % MOD;
        dp[old_root] = (dp[old_root] * invfac[n_child[old_root]]) % MOD;
        assert(n_child[old_root] == N - 1);
        n_child[old_root] -= n_child[new_root] + 1;
        dp[old_root] = (dp[old_root] * fac[n_child[old_root]]) % MOD;
        dp[new_root] = (dp[new_root] * invfac[n_child[new_root]]) % MOD;
        n_child[new_root] += n_child[old_root] + 1;
        assert(n_child[new_root] == N - 1);
        dp[new_root] = (dp[new_root] * fac[n_child[new_root]]) % MOD;
        dp[new_root] = (dp[new_root] * dp[old_root]) % MOD;
        dp[new_root] = (dp[new_root] * invfac[n_child[old_root] + 1]) % MOD;
    }
public:
    Solver(int _N, const vvi & _Es): N(_N), Es(_Es), n_child(N, 0), dp(N, 0), ans(N, 0), root(0), visited(N, false), fac(N + 1, 1), invfac(N + 1, 1){
        init();
    }
    long long solve(){
        ans[root] = dp[root];
        for (int i = 1; i < euler_tour.size(); ++i){
            int old_root = root;
            root = euler_tour[i];
            swap_root(old_root, root);
            ans[root] = dp[root];
        }
        #define print(...) {for(auto x: __VA_ARGS__) cout<<x<<endl;}
        #define debug(...) {cout<<#__VA_ARGS__": ";print(__VA_ARGS__);cout<<endl;}
        print(ans);
    }
};



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vvi Es(N);
    for (int i = 1; i < N; ++i){
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        Es[a].push_back(b);
        Es[b].push_back(a);
    }
    Solver sol(N, Es);
    sol.solve();
    return 0;
}


Measured memory_bytes: 34416