#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

constexpr ll mod = 1e9+7;
struct mint {
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    
    friend ostream &operator<<(ostream& os,const mint& a){
        return os << a.x;
    }

    friend istream &operator>>(istream& is,mint& a){
        ll t;
        is >> t;
        a = mint(t);
        return (is);
    }

    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vvec<int> g(N);
    for(int i=0;i<N-1;i++){
        int a,b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vec<mint> fact(N+1,1),fact_inv(N+1,1);
    for(ll i=1;i<=N;i++){
        fact[i] = fact[i-1]*i;
        fact_inv[i] = fact[i].inv();
    }

    vec<mint> dp(N);
    vec<int> si(N);
    {
        auto dfs = [&](auto&& self,int cur,int par)->void{
            si[cur] = 1;
            dp[cur] = 1;
            for(auto& to:g[cur]) if(to!=par){
                self(self,to,cur);
                si[cur] += si[to];
                dp[cur] *= dp[to]*fact_inv[si[to]];
            }
            dp[cur] *= fact[si[cur]-1];
        };
        dfs(dfs,0,-1);
    }
    vec<mint> ans(N);
    {
        auto dfs = [&](auto&& self,int cur,int par,mint val)->void{
            int n = g[cur].size();
            vec<mint> L(n+1,1),R(n+1,1);
            mint res = 1;
            int sum = 0;
            for(int i=0;i<n;i++){
                int to = g[cur][i];
                if(to!=par){
                    L[i+1] = L[i]*dp[to]*fact_inv[si[to]];
                    res *= dp[to]*fact_inv[si[to]];
                    sum += si[to];
                }else L[i+1] = L[i];
            }
            for(int i=n-1;i>=0;i--){
                int to = g[cur][i];
                if(to!=par){
                    R[i] = R[i+1]*dp[to]*fact_inv[si[to]];
                }else R[i] = R[i+1];
            }
            ans[cur] = res*val*fact_inv[N-sum-1]*fact[N-1];
            for(int i=0;i<n;i++){
                int to = g[cur][i];
                if(to==par) continue;
                mint nv = L[i]*R[i+1]*val*fact_inv[N-sum-1]*fact[N-si[to]-1];
                self(self,to,cur,nv);
            }
        };
        dfs(dfs,0,-1,1);
    }
    for(auto& x:ans) cout << x << "\n";
}

Measured memory_bytes: 22132