#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
const ll INF = 1LL<<60;
typedef pair<ll, ll> P;

class mint{
    public:
        ll x;
        static unsigned long long mod;
        static unsigned long long mod_plus;
        mint(){x = 0;}
        mint(ll _x) : x((_x < 0 ? ((_x += mod_plus) < 0 ? _x + mod_plus : _x) : _x)%mod){}
        /*mint& operator=(const ll &a){
            x = a;
            return *this;
        }*/

        mint operator-(){
            return x == 0 ? 0 : mod - x;
        }
        mint& operator+=(const mint& a){
            if((x += a.x) >= mod) x -= mod;
            return *this;
        }
        mint operator+(const mint& a) const{
            mint res(*this);
            return res += a;
        }
        mint& operator-=(const mint& a){
            if((x -= a.x) < 0) x += mod;
            return *this;
        }
        mint operator-(const mint& a) const{
            mint res(*this);
            return res -= a;
        }
        mint& operator*=(const mint& a){
            (x *= a.x)%=mod;
            return *this;
        }
        /*mint& operator*=(const ll& a){
            mint temp(a);
            return *this *= temp;
        }*/
        mint operator*(const mint& a) const{
            mint res(*this);
            return res *= a;
        }
        /*mint operator*(const ll& a) const{
            mint res(*this);
            return res *= a;
        }*/
        mint pow(unsigned long long pw) const{
            mint res(1), comp(*this);
            while(pw){
                if(pw&1) res *= comp;
                comp *= comp;
                pw >>= 1;
            }
            return res;
        }
        //以下、modが素数のときのみ
        mint inv() const{
            mint res(*this);
            return res.pow(mod - 2);
        }
        mint& operator/=(const mint &a){
            (x *= a.inv().x)%=mod;
            return *this;
        }
        mint operator/(const mint &a) const{
            mint res(*this);
            return res /= a;
        }
};
ostream& operator<<(ostream& os, const mint& a){
    os << a.x;
    return os;
}
unsigned long long mint::mod = int(1e+9) + 7;
unsigned long long mint::mod_plus = (LLONG_MAX / mint::mod) * mint::mod;
typedef vector<mint> vm;

struct edge{
    int to, num, rev;
    mint cost;
    edge(){}
    edge(int a, int b){
        to = a;
        rev = b;
        num = -1;
    }
};
vector<vector<edge> > G(int(2e+5), vector<edge>(0));
vm res(int(2e+5), mint(1)), res2(int(2e+5), mint(1)),fact(int(2e+5) + 10, mint(1));
vector<bool> used(int(2e+5), false);

typedef pair<int, mint> tp;
tp dfs(int v){
    used[v] = true;
    int sum = 0;
    for(edge &e : G[v]){
        if(!used[e.to]){
            tp p = dfs(e.to);
            tie(e.num, e.cost) = p;
            sum += e.num;
            res2[v] *= e.cost / fact[e.num];
        }
    }
    res2[v] *= fact[sum];
    used[v] = false;
    /*if(v == 0){
        for(edge e : G[v]){
            G[e.to][e.rev].num = N - e.num;
            G[e.to][e.rev].cost = res2[0] * fact[N - e.num - 1] * fact[e.num] / (e.cost * fact[N]);
        }
    }*/
    tp ans = tp(sum + 1, res2[v]);
    return ans;
}

void dfs2(int v){
    used[v] = true;
    res[v] *= fact[N - 1];
    for(edge e : G[v]){
        //if(v == 1) cout<<e.to<<' '<<e.cost<<' '<<e.num<<endl;
        res[v] *= e.cost / fact[e.num];
    }
    for(edge e : G[v]){
        G[e.to][e.rev].num = N - e.num;
        G[e.to][e.rev].cost = res[v] * fact[N - e.num - 1] * fact[e.num] / (e.cost * fact[N - 1]);
        if(!used[e.to]) dfs2(e.to);
    }
    used[v] = false;
}

int main() {
    cin>>N;
    rep(i,N - 1){
        cin>>A>>B;
        --A;
        --B;
        G[A].emplace_back(B, G[B].size());
        G[B].emplace_back(A, G[A].size() - 1);
    }
    reps(i,1,int(2e+5) + 10) fact[i] *= fact[i-1] * i;
    dfs(0);
    //cout<<'a'<<endl;
    dfs2(0);
    rep(i,N) cout<<res[i]<<endl;
}

Measured memory_bytes: 27008