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

template <typename T>
T pow(T a, long long n, T e = 1) {
    T ret = e;
    while (n) {
        if (n & 1) ret *= a;
        a *= a;
        n >>= 1;
    }
    return ret;
}

template <int mod>
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {
        if ((x = x_ % mod + mod) >= mod) x -= mod;
    }
    ModInt& operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0) x += mod;
        return *this;
    }
    ModInt& operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod;
        return *this;
    }
    ModInt& operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod;
        return *this;
    }

    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }

    friend ostream& operator<<(ostream& s, ModInt<mod> a) {
        s << a.x;
        return s;
    }
    friend istream& operator>>(istream& s, ModInt<mod>& a) {
        s >> a.x;
        return s;
    }
};

using mint = ModInt<1000000007>;

constexpr int MAX_FACTORIAL = 202020;

mint fact[MAX_FACTORIAL];
mint factinv[MAX_FACTORIAL];

void init() {
    fact[0] = 1;
    for (int i = 1; i < MAX_FACTORIAL; i++) {
        fact[i] = fact[i - 1] * i;
    }
    factinv[MAX_FACTORIAL - 1] = fact[MAX_FACTORIAL - 1].inv();
    for (int i = MAX_FACTORIAL - 2; i >= 0; i--) {
        factinv[i] = factinv[i + 1] * (i + 1);
    }
    assert(factinv[0] == 1);
}

mint ncr(int n, int r) { return fact[n] * factinv[r] * factinv[n - r]; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    init();

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

    vector<mint> dp(n, 1);
    vector<mint> coefs(n);
    vector<int> sz(n, 1);
    auto dfs = [&](auto dfs, int v, int p) -> void {
        for (int s : adj[v]) {
            if (s != p) {
                dfs(dfs, s, v);
                sz[v] += sz[s];
            }
        }
        mint coef = fact[sz[v] - 1];
        for (int s : adj[v]) {
            if (s != p) {
                coef /= fact[sz[s]];
                dp[v] *= dp[s];
            }
        }
        dp[v] *= coef;
        coefs[v] = coef;
    };
    dfs(dfs, 0, -1);

    vector<mint> pdp(n, 1);
    auto dfs2 = [&](auto dfs2, int v, int p) -> void {
        if (p != -1) {
            mint ret = dp[p] / coefs[p];
            ret /= dp[v];
            ret *= pdp[p];
            mint coef = coefs[p] / fact[sz[p] - 1] * fact[sz[v]] / fact[n - sz[p]] * fact[n - 1 - sz[v]];
            ret *= coef;
            pdp[v] = ret;
        }
        for (int s : adj[v]) {
            if (s != p) {
                dfs2(dfs2, s, v);
            }
        }
    };
    dfs2(dfs2, 0, -1);
    vector<mint> ans(n);
    auto dfs3 = [&](auto dfs3, int v, int p) -> void {
        mint a = dp[v] / coefs[v] * pdp[v] * fact[n - 1] / fact[n - sz[v]];
        for (int s : adj[v]) {
            if (s != p) {
                a /= fact[sz[s]];
                dfs3(dfs3, s, v);
            }
        }
        ans[v] = a;
    };
    dfs3(dfs3, 0, -1);
    for (int i = 0; i < n; i++) {
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 19444