#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)


struct mint{
    static const long long MOD = 1000000007;

    long long v;

    mint() : v(0) {}
    mint(long long x){
        x = x % MOD;
        if(x < 0){ x += MOD; }
        v = x;
    }
    mint& operator+=(mint a){
        v += a.v;
        if(v >= MOD){ v -= MOD; }
        return *this;
    }
    mint& operator*=(mint a){
        v *= a.v;
        v %= MOD;
        return *this;
    }
    mint& operator-=(mint a){
        v -= a.v;
        if(v < 0){ v += MOD; }
        return *this;
    }
    mint& operator/=(mint a){
        return (*this) *= a.inv();
    }

    mint operator*(mint a) const{
        return mint(v) *= a;
    }

    mint operator+(mint a) const {
        return mint(v) += a;
    }

    mint operator-(mint a) const {
        return mint(v) -= a;
    }

    mint operator/(mint a) const {
        return mint(v) /= a;
    }

    mint pow(long long k) const {
        mint res(1),tmp(v);
        while(k){
            if(k&1) res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    mint inv(){return pow(MOD - 2); }

    static mint comb(long long n, int k){
        mint res(1);
        for(int i = 0; i < k; ++i){
            res *= mint(n - i);
            res /= mint(i + 1);
        }
        return res;
    }

    static mint factorial(long long n){
        mint res(1);
        for(int i = n; i > 1; --i){
            res *= mint(i);
        }
        return res;
    }

    bool operator<(const mint &a) const {
        return v < a.v;
    };
};

mint operator*(long long l, mint r){ return r * l; }

std::ostream& operator<<(std::ostream& stream, const mint& m){
    stream << m.v;
    return stream;
}

struct mintcomb{
    vector<mint> fact;
    vector<mint> ifact;
    mintcomb(ll n) : fact(n + 1, 1), ifact(n + 1, 1) {
        for(ll i = 2; i <= n; ++i){
            fact.at(i) = fact.at(i - 1) * i;
            ifact.at(i) = fact.at(i).inv();
        }
    }
    mint factorial(ll k) const { return fact.at(k); }
    mint combination(ll k, ll l) const {
        return fact.at(k) * ifact.at(l) * ifact.at(k - l);
    }
};

mintcomb mc(200001);

struct DP {
  mint dp;
  ll t;

  DP(mint dp=1, ll t=0) : dp(dp), t(t) {}

  DP& operator+=(const DP& a) {
    dp *= a.dp;
    dp *= mc.combination(t + a.t, t);
    t += a.t;
    return *this;
  }
  DP operator-(const DP& a) const {
    DP res(*this);
    res.t -= a.t;
    res.dp /= mc.combination(res.t + a.t, res.t);
    res.dp /= a.dp;
    return res;
  }
  DP addRoot() const {
    DP res(*this);
    res.t++;
    return res;
  }
};

vector<vector<ll>> net;
vector<DP> dp;

void dfs(ll v, ll p=-1) {
    for(ll u : net.at(v)){
        if(u == p){ continue; }
        dfs(u,v);
        dp.at(v) += dp.at(u).addRoot();
    }
}

void bfs(int v, int p=-1){
    for(int u : net.at(v)){
        if(u == p){ continue; }
        DP d = dp.at(v) - dp.at(u).addRoot();
        dp.at(u) += d.addRoot();
        bfs(u,v);
    }
}
 
int main() {
    ll n;
    cin >> n;
    net.resize(n);
    REP(i, n - 1){
        ll a, b;
        cin >> a >> b;
        --a; --b;
        net.at(a).push_back(b);
        net.at(b).push_back(a);
    }
    dp.resize(n);
    dfs(0);
    bfs(0);
    REP(i,n){
        cout << dp.at(i).addRoot().dp << endl;
    }
  return 0;
}


Measured memory_bytes: 20976