#include<bits/stdc++.h>
#define endl '\n';
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------

// snukeさんのmodint
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;
  }

  // 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;
  }
};

// mint N;

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 c(N);
// mint ans = c(N,n);
// cout << ans.x << endl;
// Nとnはll型(mintではない)
// -------------------------------------------------------------

const int MAX_N = 200005;
vector<vector<int>> G(MAX_N);
combination comb(MAX_N);

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 addRoot() const{
        DP res(*this);
        res.t++;
        return res;
    }
};

vector<vector<DP>> dp(MAX_N);
vector<DP> dpSum(MAX_N);

DP dfs(int v,int p=-1){
    dp[v] = vector<DP>(G[v].size());

    for(int i=0; i<G[v].size(); i++){
        int u = G[v][i];
        if(u == p) continue;
        dp[v][i] = dfs(u,v);
        dpSum[v] += dp[v][i];
    }
    return dpSum[v].addRoot();
}

void bfs(int v,const DP& dpP=DP(),int p=-1){
    if(p != -1) dpSum[v] += dpP;
    for(int i=0; i<G[v].size(); i++){
        int u = G[v][i];
        if(u == p){
            dp[v][i] = dpP;
            continue;
        }
        DP d = dpSum[v] - dp[v][i];
        bfs(u,d.addRoot(),v);
    }
}

int main(){
    int N;
    cin >> N;
    for(int i=0; i<N-1; i++){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    dfs(0);
    bfs(0);
    for(int i=0; i<N; i++){
        cout << dpSum[i].dp.x << endl;
    }
    return 0;
}

Measured memory_bytes: 34292