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

constexpr int64_t MOD = 1e9 + 7;
constexpr int64_t MAX_N = 2e5;

//a^b % modを求める
int64_t MODpow(int64_t a, int64_t b, int64_t mod) {
    int64_t result = 1;
    while (b) {
        if (b % 2 == 1) {
            result *= a;
            result %= mod;
        }

        b /= 2;
        a *= a;
        a %= mod;
    }

    return result;
}

class Combination {
public:
    Combination(int64_t max_num, int64_t mod) {
        fact.resize(max_num + 1, 1);
        inv_fact.resize(max_num + 1, 1);
        mod_ = mod;
        for (int64_t i = 2; i <= max_num; i++) {
            fact[i] = i * fact[i - 1] % mod_;
            inv_fact[i] = MODpow(fact[i], mod_ - 2, mod_);
            assert(fact[i] * inv_fact[i] % mod_ == 1);
        }
    }
    int64_t operator()(int64_t n, int64_t m) const {
        if (m < 0 || m > n) return 0;
        return fact[n] * inv_fact[n - m] % mod_ * inv_fact[m] % mod_;
    }
    vector<int64_t> fact, inv_fact;
private:
    int64_t mod_;
};
Combination comb(MAX_N, MOD);

struct DP_Element {
    int64_t dp, size;
    DP_Element() : dp(1), size(1) {}
    DP_Element operator+=(const DP_Element& rhs) {
        (dp *= rhs.dp) %= MOD;
        (dp *= comb.inv_fact[rhs.size]) %= MOD;
        size += rhs.size;
        return *this;
    }
};

int main() {
    int64_t N;
    cin >> N;
    vector<vector<int64_t>> connect(N);
    for (int64_t i = 0; i < N - 1; i++) {
        int64_t a, b;
        cin >> a >> b;
        a--; b--;
        connect[a].push_back(b);
        connect[b].push_back(a);
    }


    //dp1[i] := 0を根としたときのノードi以下の部分木についての答え
    vector<DP_Element> dp1(N);
    function<DP_Element(int64_t, int64_t)> f1 = [&](int64_t curr, int64_t pre) {
        for (int64_t next_node : connect[curr]) {
            if (next_node == pre) {
                continue;
            }

            DP_Element next_dp = f1(next_node, curr);
            dp1[curr] += next_dp;
        }

        (dp1[curr].dp *= comb.fact[dp1[curr].size - 1]) %= MOD;
        return dp1[curr];
    };

    f1(0, -1);

    //dp2[i] := iを根としたときのiについての答え
    vector<DP_Element> dp2(N);
    dp2[0] = dp1[0];
    function<void(int64_t, int64_t)> f2 = [&](int64_t curr, int64_t pre) {
        for (int64_t next_node : connect[curr]) {
            if (next_node == pre) {
                continue;
            }

            DP_Element add = dp2[curr];
            //dp1[next_node]からの影響を取り除く
            (add.dp *= comb.inv_fact[add.size - 1]) %= MOD;
            (add.dp *= MODpow(dp1[next_node].dp, MOD - 2, MOD)) %= MOD;
            (add.dp *= comb.fact[dp1[next_node].size]) %= MOD;
            add.size -= dp1[next_node].size;
            (add.dp *= comb.fact[add.size - 1]) %= MOD;

            //dp2[next_node]に足す
            DP_Element& target = dp2[next_node];
            target = dp1[next_node];
            (target.dp *= comb.inv_fact[target.size - 1]) %= MOD;
            target += add;
            (target.dp *= comb.fact[target.size - 1]) %= MOD;

            //次へ遷移
            f2(next_node, curr);
        }
    };

    f2(0, -1);

    for (int64_t i = 0; i < N; i++) {
        cout << dp2[i].dp << endl;
    }
}

Measured memory_bytes: 24048