#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)



















template<int MOD_>
class ModInt {
private:
public:
    long long val;
    constexpr ModInt(long long v = 0) noexcept : val(v % MOD_) {
        if (val < 0) val += MOD_;
    }
    constexpr int getmod() { return MOD_; }
    constexpr ModInt operator - () const noexcept {
        return val ? MOD_ - val : 0;
    }
    constexpr ModInt operator + (const ModInt& r) const noexcept { return ModInt(*this) += r; }
    constexpr ModInt operator - (const ModInt& r) const noexcept { return ModInt(*this) -= r; }
    constexpr ModInt operator * (const ModInt& r) const noexcept { return ModInt(*this) *= r; }
    constexpr ModInt operator / (const ModInt& r) const noexcept { return ModInt(*this) /= r; }
    constexpr ModInt operator % (const ModInt& r) const noexcept { return ModInt(*this) %= r; }
    constexpr ModInt operator ^ (const ModInt& r) const noexcept { return ModInt(*this) ^= r; }
    constexpr ModInt operator & (const ModInt& r) const noexcept { return ModInt(*this) &= r; }
    constexpr ModInt operator | (const ModInt& r) const noexcept { return ModInt(*this) |= r; }
    constexpr ModInt& operator += (const ModInt& r) noexcept {
        val += r.val;
        if (val >= MOD_) val -= MOD_;
        return *this;
    }
    constexpr ModInt& operator -= (const ModInt& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD_;
        return *this;
    }
    constexpr ModInt& operator *= (const ModInt& r) noexcept {
        val = val * r.val % MOD_;
        return *this;
    }
    constexpr ModInt& operator /= (const ModInt& r) noexcept {
        long long a = r.val, b = MOD_, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD_;
        if (val < 0) val += MOD_;
        return *this;
    }
    constexpr ModInt& operator %= (const ModInt& r) noexcept {
        assert(r != 0);
        val = val % r.val;
        return *this;
    }
    constexpr ModInt& operator ^= (const ModInt& r) noexcept {
        val = (val ^ r.val) % MOD_;
        return *this;
    }
    constexpr ModInt& operator &= (const ModInt& r) noexcept {
        val = val & r.val;
        return *this;
    }
    constexpr ModInt& operator |= (const ModInt& r) noexcept {
        val = (val | r.val) % MOD_;
        return *this;
    }
    constexpr bool operator == (const ModInt& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const ModInt& r) const noexcept {
        return this->val != r.val;
    }
    constexpr bool operator < (const ModInt& r) const noexcept {
        return this->val < r.val;
    }
    constexpr bool operator > (const ModInt& r) const noexcept {
        return this->val > r.val;
    }
    constexpr bool operator <= (const ModInt& r) const noexcept {
        return this->val <= r.val;
    }
    constexpr bool operator >= (const ModInt& r) const noexcept {
        return this->val >= r.val;
    }
    constexpr bool operator && (const ModInt& r) const noexcept {
        return this->val && r.val;
    }
    constexpr bool operator || (const ModInt& r) const noexcept {
        return this->val || r.val;
    }
    constexpr ModInt& operator ++ () noexcept {
        val = (val + 1) % MOD_;
        return *this;
    }
    constexpr ModInt operator ++ (int n) noexcept {
        ModInt<MOD_> t = *this;
        val = (val + 1) % MOD_;
        return t;
    }
    constexpr ModInt& operator -- () noexcept {
        val = (val - 1 + MOD_) % MOD_;
        return *this;
    }
    constexpr ModInt operator -- (int n) noexcept {
        ModInt<MOD_> t = *this;
        val = (val - 1 + MOD_) % MOD_;
        return t;
    }
    constexpr ModInt operator ! () noexcept {
        return val? 1 : 0;
    }
    friend constexpr ostream& operator << (ostream &os, const ModInt<MOD_>& x) noexcept {
        return os << x.val;
    }
    friend constexpr istream& operator >> (istream &is, ModInt<MOD_>& x) noexcept {
        return is >> x.val;
    }
    friend constexpr ModInt<MOD_> modpow(const ModInt<MOD_> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

class Combination {
private:
    vector<ll> fact, finv, inv;
    ll mod;
    
public:
    Combination(ll mod = 1e9 + 7, ll table_size = 300005) : mod(mod),
                                                            fact(vector<ll>(table_size)),
                                                            finv(vector<ll>(table_size)),
                                                            inv(vector<ll>(table_size))  {
        fact[0] = fact[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (ll i = 2; i < table_size; i++){
            fact[i] = fact[i - 1] * i % mod;
            inv[i] = mod - inv[mod % i] * (mod / i) % mod;
            finv[i] = finv[i - 1] * inv[i] % mod;
        }
    }
    
    ll operator () (ll n, ll r){
        if(n < r || n < 0 || r < 0) return 0;
        return fact[n] * (finv[r] * finv[n - r] % mod) % mod;
    }
};




vector<vector<ll>> g;
Combination comb;

struct DP {
    ModInt<MOD> dp;
    ll t;
    DP(ModInt<MOD> dp = 1, ll 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<DP> dp;

void dfs(ll now, ll par = -1){
    for(auto &next : g[now]){
        if(next == par) continue;
        dfs(next, now);
        dp[now] += dp[next].addRoot();
    }
}

void dfs2(ll now, ll par = -1){
    for(auto &next : g[now]){
        if(next == par) continue;
        DP d = dp[now] - dp[next].addRoot();
        dp[next] += d.addRoot();
        dfs2(next, now);
    }
}


int main(){
    ll n;
    cin >> n;
    g.resize(n);
    dp.resize(n);
    REP(i, n - 1){
        ll a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    dfs(0);
    dfs2(0);
    REP(i, n){
        cout << dp[i].addRoot().dp << endl;
    }
}

Measured memory_bytes: 26240