#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
const long long  MOD = 1000000007;

//mod int
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
using mint = Fp<MOD>;


vector<vector<int>> G;
//下流にあるnodeの数
int sz[202020];
mint dp[202020];
//階乗のmod
mint fac[202020];
mint ans[202020];
long long N;

void dfs1(int v, int par){
    dp[v]=1;
    //これは範囲for文
    for(auto nv:G[v]){
        if(nv==par) continue; //逆戻りしてこないように
        dfs1(nv,v);
        //nv分だけ加えていく
        sz[v]+=sz[nv];
        dp[v]*=dp[nv]*fac[sz[v]]/fac[sz[v]-sz[nv]]/fac[sz[nv]];
    }
    sz[v]++;
}

void dfs2(int v,int par,mint val){
    ans[v]=dp[v]*val*fac[N-1]/fac[N-sz[v]]/fac[sz[v]-1];
    for(auto nv:G[v]){
        if(nv==par) continue;
        //nvを根とした時を想定
        mint next=ans[v]/dp[nv]/(fac[N-1]/fac[sz[nv]]/fac[N-sz[nv]-1]);
        dfs2(nv,v,next);
    }
}

int main(){

cin >> N;
    G.resize(N);
    REP(i,N-1){
        int a, b;
        cin >> a >> b;
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    fac[0] = 1;
    for(int i=1;i<202020;i++) fac[i] = fac[i-1] * i;
    dfs1(0, -1);
    dfs2(0, -1, 1);
    REP(i,N) cout << ans[i] << endl;
return 0;
}


Measured memory_bytes: 19444