#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
struct mint {
    int x;
    mint(int x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    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 { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(int 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;
    }
};

//modintCompare

mint F[2100010];
void fact(void) {
	F[0] = mint(1);
	F[1] = mint(1);
	for (int i = 2; i <= 2100000; i++) {
        mint x(i);
		F[i] = x * F[i - 1];
	}
}

mint square(mint x) {
    return x * x;
}

mint power(mint x, int y) {
    if (y == 0) return mint(1);
    else if (y == 1) return x;
    else if (y % 2 == 0) return square(power(x, y / 2));
    else return square(power(x, y / 2)) * x;
}

mint P(int n, int r) {
	if (n < r || n < 0 || r < 0) return mint(0);
	return F[n]/F[n - r];
}

mint C(int n, int r) {
	if (n < r || n < 0 || r < 0) return mint(0);
	mint ret;
	ret = F[n]/(F[n - r] * F[r]);
	return ret;
}
mint H(int n, int r) {
	if (n == 0 && r == 0) return mint(1);
	return C(n + r - 1, r);
}

vector<int> G[200010];

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 *= C(t + a.t, a.t);
        t += a.t;
        return *this;
    }
    DP operator-(const DP& a) const {
        DP res(*this);
        res.t -= a.t;
        res.dp /= C(res.t + a.t, res.t);
        res.dp /= a.dp;
        
        return res;
    }
    DP addRoot() const {
        DP res(*this);
        res.t++;
        return res;
    }
};
DP dp[200010];
void dfs(int v, int p = -1) {
    for (auto to: G[v]) {
        if(to == p) continue;
        dfs(to, v);
        dp[v] += dp[to].addRoot();
    }
}

void bfs(int v, int p = -1) {
    for (auto to: G[v]) {
        if (to == p) continue;
        DP d = dp[v] - dp[to].addRoot();
        dp[to] += d.addRoot();
        bfs(to, v);
    }
}




signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    fact();
    int n; cin >> n;
    rep(i, n - 1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    dfs(0); bfs(0);
    rep(i, n) {
        cout << dp[i].addRoot().dp.x << endl;
    }

    return 0;
}


Measured memory_bytes: 34304