// ABC 160 F
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

struct mint {
    ll x;
    mint(ll 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 {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;
    }

    // for prime mod
    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;}
};

const int cmax = 200010;
mint fac[cmax],finv[cmax],inv[cmax];

void com_init() {
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for (int i=2; i<cmax; i++) {
        fac[i]=fac[i-1]*i;
        inv[i]=-inv[MOD%i]*(MOD/i);
        finv[i]=finv[i-1]*inv[i];
    }
}

mint com(int n, int k) {
    if (n<k) return 0;
    if (n<0||k<0) return 0;
	mint ret=fac[n]*finv[k]*finv[n-k];
    return ret;
}

struct DP {
    mint dp;
    ll cnt;
    DP(mint dp = 1, ll cnt = 0) : dp(dp), cnt(cnt) {};
    DP operator+(const DP& a) const {
        DP ret(*this);
        ret.dp *= com(ret.cnt + a.cnt, ret.cnt);
        ret.dp *= a.dp;
        ret.cnt += a.cnt;
        return ret;
    }
    DP operator+=(const DP& a) const {
        DP ret(*this);
        ret = ret + a;
        return ret;
    }
    DP operator-(const DP& a) const {
        DP ret(*this);
        ret.cnt -= a.cnt;
        ret.dp /= com(ret.cnt + a.cnt, ret.cnt);
        ret.dp /= a.dp;
        return ret;
    }
    DP add_root() {
        DP ret(*this);
        ret.cnt++;
        return ret;
    }
};

vvll g;
vector<DP> dp, dpr;

void dfs(ll v, ll p = -1) {
    for(auto u : g[v]) {
        if(u == p) continue;
        dfs(u, v);
        dp[v] = dp[v] + dp[u].add_root();
    }
}

void dfs2(ll v, ll p = -1) {
    vll to;
    for(auto u : g[v]) if(u != p) to.push_back(u);
    vector<DP> dpf(to.size() + 1), dpb(to.size() + 1);
    for(ll i = 0; i < to.size(); i++) dpf[i+1] = dpf[i] + dp[to[i]].add_root();
    for(ll i = to.size(); i > 0; i--) dpb[i-1] = dpb[i] + dp[to[i-1]].add_root();
    for(ll i = 0; i < to.size(); i++) {
        dpr[to[i]] = dpr[v] + dpf[i] + dpb[i+1];
        dpr[to[i]] = dpr[to[i]].add_root();
        dfs2(to[i], v);
    }
}

void solve() {
    ll n;
    cin >> n;
    g = vvll(n);
    for(ll i = 0; i < n - 1; i++) {
        ll a, b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    dp = vector<DP>(n);
    dpr = vector<DP>(n);
    com_init();
    dfs(0);
    dfs2(0);
    for(ll i = 0; i < n; i++) {
        DP d = dp[i] + dpr[i];
        cout << d.dp.x << endl;
    }
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 31600