#include <bits/stdc++.h>
using namespace std;
using ll = long long;


const ll MOD = 1e9 + 7;
template<ll MOD> struct ModInt {
    ll value;
    ModInt() : value(0) {}
    ModInt(const ll& v) : value(v % MOD) {
        if ( value < 0 ) value += MOD;
    }
    ModInt<MOD>& operator=(const ModInt& o) {
        value = o.value;
        return *this;
    }
    inline bool operator==(const ModInt& o) {
        return value == o.value;
    }
    inline bool operator!=(const ModInt& o) {
        return value != o.value;
    }
    ModInt<MOD>& operator+=(const ModInt& o) {
        value += o.value;
        if ( value >= MOD ) value -= MOD;
        return *this;
    }
    ModInt<MOD>& operator-=(const ModInt& o) {
        value += MOD - o.value;
        if (value >= MOD ) value -= MOD;
        return *this;
    }
    ModInt<MOD>& operator*=(const ModInt& o) {
        value *= o.value;
        value %= MOD;
        return *this;
    }
    ModInt<MOD>& operator/=(const ModInt& o) {
        value *= inverse(o.value);
        value %= MOD;
        return *this;
    }
    ModInt<MOD> operator-() {
        return ModInt<MOD>(-value);
    }
    ModInt<MOD> operator+(const ModInt& o) {
        ModInt<MOD> r(*this);
        r += o;
        return r;
    }
    ModInt<MOD> operator-(const ModInt& o) {
        ModInt<MOD> r(*this);
        r -= o;
        return r;
    }
    ModInt<MOD> operator*(const ModInt& o) {
        ModInt<MOD> r(*this);
        r *= o;
        return r;
    }
    ModInt<MOD> operator/(const ModInt& o) {
        ModInt<MOD> r(*this);
        r /= o;
        return r;
    }
    ModInt<MOD> pow(ll n) {
        ModInt<MOD> t(*this), r = 1;
        while ( n > 0 ) {
            if ( n & 1 ) r *= t;
            t *= t;
            n >>= 1;
        }
        return r;
    }
private:
    ll inverse(ll a) {
        ModInt<MOD> t(a);
        return t.pow(MOD - 2).value;
    }
};
template<ll MOD> std::ostream& operator<< (std::ostream& os, const ModInt<MOD>& o) {
    os << o.value;
    return os;
}
template<ll MOD> std::istream& operator>> (std::istream& is, ModInt<MOD>& o) {
    is >> o.value;
    return is;
}

//---------------------------
// 二項係数
template<typename T> struct Combination {
    ll n_max;
    vector<T> fac, finv, inv;
    Combination(ll n_max) {
        fac.resize(n_max+1);
        finv.resize(n_max+1);
        inv.resize(n_max+1);
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[0] = 0, inv[1] = 1;
        for (int i = 2; i <= n_max; i++){
            fac[i] = fac[i - 1] * i;
            inv[i] = - inv[MOD%i] * (MOD / i);
            finv[i] = finv[i - 1] * inv[i];
        }
    }
    T C(ll n, ll k) {
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        return fac[n] * finv[k] * finv[n - k];
    }
    T P(ll n, ll k) {
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        return fac[n] * finv[n - k];
    }
    T H(ll n, ll k) {
        return C(n+k-1, k);
    }
};

using Int = ModInt<MOD>;


ll solve() {
    ll N;
    cin >> N;
    vector<vector<int>> G(N);
    int a, b;
    for ( int i = 0; i < N-1; i++ ) {
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    Combination<Int> cb(N+1);

    vector<ll> nc(N);
    vector<int> dep(N);
    vector<vector<Int>> w(N);
    function<Int(int,int)> dfs1 = [&](int v, int p) {
        ll n = 1;
        Int wt = 1;
        dep[v] = p == -1 ? 0 : dep[p] + 1;
        for ( int i = 0; i < G[v].size(); i++ ) {
            int u = G[v][i];
            if ( u == p ) {
                w[v].push_back(Int(0));
                continue;
            }
            Int wc = dfs1(u, v);
            w[v].push_back(wc);
            n += nc[u];
            wt *= wc;
            wt *= cb.finv[nc[u]];
        }
        nc[v] = n;
        wt *= cb.fac[n-1];
        return wt;
    };
    dfs1(0,-1);

    function<void(int,int,Int)> dfs2 = [&](int v, int p, Int wp) {
        int cc = G[v].size();
        vector<Int> wl(cc+1), wr(cc+1);
        wl[0] = Int(1), wr[cc] = Int(1);
        for ( int i = 0; i < cc; i++ ) {
            int u = G[v][i];
            Int wt = u == p ? wp : w[v][i];
            ll n = dep[u] > dep[v] ? nc[u] : N-nc[v];
            wl[i+1] = wl[i] * wt;
            wl[i+1] *= cb.finv[n];
        }
        for ( int i = cc; i > 0; i-- ) {
            int u = G[v][i-1];
            Int wt = u == p ? wp : w[v][i-1];
            ll n = dep[u] > dep[v] ? nc[u] : N-nc[v];
            wr[i-1] = wr[i] * wt;
            wr[i-1] *= cb.finv[n];
        }
        for ( int i = 0; i < cc; i++ ) {
            int u = G[v][i];
            ll n = dep[u] > dep[v] ? nc[u] : N-nc[v];
            Int wt = wl[i] * wr[i+1] * cb.fac[N-n-1];
            if ( u == p ) {
                w[v][i] = wp;
                continue;
            }
            dfs2(u, v, wt);
        }
    };
    dfs2(0,-1,Int(1));

    vector<Int> ans;
    for ( int k = 0; k < N; k++ ) {
        Int ww = Int(1);
        for ( int i = 0; i < G[k].size(); i++ ) {
            int u = G[k][i];
            ll n = dep[u] > dep[k] ? nc[u] : N-nc[k];
            ww *= w[k][i] * cb.finv[n];
        }
        ww *= cb.fac[N-1];
        ans.push_back(ww);
    }

    for ( int i = 0; i < N; i++ ) {
        cout << ans[i] << "\n";
    }

    return 0;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 37048