#include <bits/stdc++.h>

using namespace std;

#define all(x) begin(x), end(x)

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

struct modint {
    static const int MOD = 1e9 + 7;
    // static const int MOD = 998244353;

    int v;
    modint(const int _v = 0): v(_v % MOD) {
        if (v < 0) v += MOD;
    }

    modint(const modint& other) {
        v = other.v;
    }

    bool operator==(const modint& other) const {
        return v == other.v;
    }

    modint& operator+=(const modint& other) {
        v += other.v;
        if (v >= MOD)
            v -= MOD;
        return *this;
    }

    modint& operator-=(const modint& other) {
        v -= other.v;
        if (v < 0)
            v += MOD;
        return *this;
    }

    modint& operator*=(const modint& other) {
        v = 1LL * v * other.v % MOD;
        return *this;
    }

    modint& operator/=(const modint& other) {
        *this *= other.inv();
        return *this;
    }

    modint operator+(const modint& other) const {
        return modint(v) += other;
    }

    modint operator-(const modint& other) const {
        return modint(v) -= other;
    }

    modint operator*(const modint& other) const {
        return modint(v) *= other;
    }

    modint operator/(const modint& other) const {
        return modint(v) /= other;
    }

    static modint pow(const modint& b, ll e) {
        if (e == 0) return 1;
        modint x = pow(b * b, e / 2);
        return (e % 2) ? b * x : x;
    }

    modint pow(ll e) const {
        return pow(*this, e);
    }

    modint inv() const {
        return pow(MOD - 2);
    }

    friend ostream& operator<<(ostream& os, modint m) {
        return os << m.v;
    }
};

constexpr int MAXN = 2e5 + 5;
// constexpr int MAXN = 200;
modint fact[MAXN], tcaf[MAXN];

void gen_fact() {
    fact[0] = 1;
    for (int i = 1; i < MAXN; ++i) {
        fact[i] = fact[i - 1] * i;
    }

    tcaf[MAXN - 1] = modint(1) / fact[MAXN - 1];
    for (int i = MAXN - 2; i >= 0; --i) {
        tcaf[i] = tcaf[i + 1] * (i + 1);
    }
}

modint choose(int n, int k) {
    assert(n >= 0);
    assert(0 <= k and k <= n);

    return fact[n] * tcaf[k] * tcaf[n - k];
}

int n;

vi tree[MAXN];
int sub_sz[MAXN];
modint dp[MAXN];
modint ans[MAXN];

void dfs0(int u, int p) {
    dp[u] = 1;
    sub_sz[u] = 1;
    for (int v : tree[u]) {
        if (v == p) continue;

        dfs0(v, u);
        sub_sz[u] += sub_sz[v];
    }

    // this is a multinomial!
    // split N chars into X xs, Y ys, Z zs
    // N! / X! / Y! / Z!
    dp[u] *= fact[sub_sz[u] - 1];
    for (int v : tree[u]) {
        if (v == p) continue;
        dp[u] *= tcaf[sub_sz[v]] * dp[v];
    }
}

void dfs1(int u, int p) {
    ans[u] = dp[u];
    for (int v : tree[u]) {
        if (v == p) continue;

        modint old_u = dp[u];
        modint old_v = dp[v];
        int old_sz_u = sub_sz[u];
        int old_sz_v = sub_sz[v];

        dp[u] *= tcaf[sub_sz[u] - 1];
        dp[u] *= fact[sub_sz[v]];
        dp[u] /= dp[v];

        dp[v] *= tcaf[sub_sz[v] - 1];

        sub_sz[u] -= sub_sz[v];
        sub_sz[v] = old_sz_u;

        dp[u] *= fact[sub_sz[u] - 1];

        dp[v] *= fact[sub_sz[v] - 1];
        dp[v] *= tcaf[sub_sz[u]] * dp[u];

        dfs1(v, u);

        dp[u] = old_u;
        dp[v] = old_v;

        sub_sz[u] = old_sz_u;
        sub_sz[v] = old_sz_v;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    gen_fact();

    cin >> n;
    for (int i = 1; i < n; ++i) {
        int u, v;
        cin >> u >> v;
        --u; --v;
        tree[u].push_back(v);
        tree[v].push_back(u);
    }

    dfs0(0, -1);
    dfs1(0, -1);

    for (int u = 0; u < n; ++u) {
        cout << ans[u] << '\n';
    }
    
    return 0;
}


Measured memory_bytes: 18432