#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < ll(n); i++)
typedef pair<ll, ll> P;

const ll mod = 1000000007;
struct mint {
    ll x;  // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

struct combination {
    vector<mint> fact, ifact;
    // init struct with "n" of "nCk" (maximum number in other words)
    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
    }
    // c(n,k) returns mint that contains nCk (mod p (= 1e9+7)) in x
    // i.e.) mint num = c(n,k), then num.x == nCk (mod p (= 1e9+7))
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }

    // nPk - permutation
    mint p(int n, int k) {
        return fact[n] * ifact[n - k];
    }
} comb(200200);

vector<int> adj[200200];

struct DP {
    mint dp;
    int t;
    DP(mint dp = 1, int t = 0) : dp(dp), t(t) {}
    DP& operator+=(const DP& a) {
        dp *= a.dp;
        dp *= comb(t + a.t, t);
        t += a.t;
        return *this;
    }
    DP operator-(const DP& a) const {
        DP res(*this);
        res.t -= a.t;
        res.dp /= comb(res.t + a.t, res.t);
        res.dp /= a.dp;
        return res;
    }
    DP add_root() const {
        DP res(*this);
        res.t++;
        return res;
    }
};

DP dp[200200];

void dfs(int cur, int prev = -1) {
    for (int to : adj[cur]) {
        if (to == prev) continue;
        dfs(to, cur);
        dp[cur] += dp[to].add_root();
    }
}

void bfs(int cur, int prev = -1) {
    for (int to : adj[cur]) {
        if (to == prev) continue;
        DP d = dp[cur] - dp[to].add_root();
        dp[to] += d.add_root();
        bfs(to, cur);
    }
}

int main() {
    int n;
    cin >> n;
    rep(i, n - 1) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    dfs(0);
    bfs(0);
    rep(i, n) {
        cout << dp[i].add_root().dp.x << endl;
    }
}

Measured memory_bytes: 21188