#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>;

// 参考：https://ei1333.hateblo.jp/entry/2018/12/21/004022
// 全方位木DP
template<typename TAcc, typename TEdge> struct ReRooting {
    struct Edge {
        int to;
        TEdge data;
        TAcc dp; // to から this にあげる情報
    };
    using FAcc = function<TAcc(TAcc, TAcc)>;
    using FEdge = function<TAcc(TAcc, TEdge)>;
    vector<vector<Edge>> g;
    vector<TAcc> dp; // dp[v]:点vを根とするdp
    vector<TAcc> subdp; // subdp[v]:点0を根とする点vの部分木のdp
    const TAcc ident;
    const FAcc f_acc;
    const FEdge f_edge;
    ReRooting(int V, const FAcc f_acc, const FEdge f_edge, const TAcc& ident) 
        : g(V), f_acc(f_acc), f_edge(f_edge), ident(ident), subdp(V, ident), dp(V, ident) {}
    void add_edge(int u, int v, const TEdge& d) {
        g[u].emplace_back((Edge){v, d, ident});
        g[v].emplace_back((Edge){u, d, ident});
    }        
    void add_edge(int u, int v, const TEdge& d, const TEdge& rd) {
        g[u].emplace_back((Edge){v, d, ident});
        g[v].emplace_back((Edge){u, rd, ident});
    }
    void dfs_sub(int v, int pa) {
        TAcc buff(ident);
        for ( auto& e : g[v] ) {
            if ( e.to == pa ) continue;
            dfs_sub( e.to, v );
            buff = f_acc(buff, f_edge(subdp[e.to], e.data));
        }
        subdp[v] = buff;
    }
    void dfs_all(int v, int pa,const TAcc& dp_pa) {
        vector<TAcc> dps(g[v].size());
        TAcc buff(ident);
        for ( int i = 0; i < g[v].size(); i++ ) {
            Edge& e = g[v][i];
            dps[i] = buff;
            e.dp = f_edge(e.to == pa ? dp_pa : subdp[e.to], e.data);
            buff = f_acc(buff, e.dp);
        }
        dp[v] = buff;
        buff = ident;
        for ( int i = g[v].size() - 1; i >= 0; i-- ) {
            Edge& e = g[v][i];
            if ( e.to != pa ) dfs_all(e.to, v, f_acc(dps[i], buff));
            buff = f_acc(buff, e.dp);
        }
    }
    vector<TAcc> build() {
        dfs_sub(0,-1);
        dfs_all(0,-1,ident);
        return dp;
    }
};

ll solve() {
    ll N;
    cin >> N;
    vector<vector<int>> G(N);
    Combination<Int> cb(N+1);
    struct Node {
        Int w;      // dp
        int v_ct;   // vを含まないvの部分木の頂点数
    };
    const Node ident{Int(1),0};
    function<Node(Node,Node)> f_acc = [&](Node a, Node b) {
        Node x = ident;
        x.w *= a.w;
        x.w *= b.w;
        x.w *= cb.fac[a.v_ct+b.v_ct];
        x.w *= cb.finv[a.v_ct];
        x.w *= cb.finv[b.v_ct];
        x.v_ct = a.v_ct + b.v_ct;
        return x;
    };
    function<Node(Node,int)> f_edge = [](Node a, int b) {
        Node x = a;
        x.v_ct++;
        return x;
    };
    ReRooting<Node,int> g(N, f_acc, f_edge, ident);

    int a, b;
    for ( int i = 0; i < N-1; i++ ) {
        cin >> a >> b;
        a--, b--;
        g.add_edge(a,b,0);
    }
    auto dp = g.build();
    for ( auto x : dp  ) {
        cout << x.w << "\n";
    }
    return 0;
}

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


Measured memory_bytes: 39552