#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <cassert>

#define rep(i,x) for(int i = 0; i < x; i++)
#define rrep(i,x) for(int i = 1; i <= x; i++)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using ll = long long;
using namespace std;
const int INF = 1001001001;
const ll LINF = 1002003004005006007;

//const int mod = 998244353;
const int mod = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    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 { 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(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 { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
    vector<mint> fact, ifact;
    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;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

combination comb(200005);

class DP {
public:
    mint ans;
    int t;
    DP(mint ans = 1, int t = 1):ans(ans), t(t) {}
    DP operator+(const DP &rhs){
        DP res(*this); //元のオブジェクトを壊さないようにコピー
        res.t += rhs.t; //ansの処理より先に足す
        res.ans *= rhs.ans;
        res.ans *= comb(res.t - 1, rhs.t); //子の数の総数は親を引いて res.t - 1
        return res;
    }
    DP operator-(const DP &rhs){
        DP res(*this);
        res.ans /= rhs.ans;
        res.ans /= comb(res.t - 1, rhs.t);
        res.t -= rhs.t; //ansの処理の後に引く
        return res;
    }
    DP addRoot() const {
        DP res(*this);
        res.t++;
        return res;
    }
};

void dfs(int v, vector<vector<int>> &to, vector<DP> &dp, int p = -1){
    for (int nv : to[v]){
        if (nv == p) continue;
        dfs(nv, to, dp, v); //先に潜り最下層に着いたら処理を開始
        dp[v] = dp[v] + dp[nv];
    }
}

void bfs(int v, vector<vector<int>> &to, vector<DP> &dp, int p = -1){
    for (int nv : to[v]){
        if (nv == p) continue;
        dp[nv] = dp[nv] + (dp[v] - dp[nv]); //頂点を見つけるごとに処理をしてから潜る
        bfs(nv, to, dp, v);
    }
}

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

}


Measured memory_bytes: 20212