#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).rbegin(), (x).rend())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
#define SP << " " <<
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "-1" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------
template< int mod >
struct ModInt {
    int x;

    ModInt() : x(0) {}
    ModInt(ll y) : x(y >= 0 ? ( y<mod ? y : y%mod ) : (mod - (-y) % mod) % mod) {}

    ModInt &operator+=(const ModInt &p) {
        if((x += p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p) {
        if((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p) {
        x = (int) (1LL * x * p.x % mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p) {
        *this *= p.inv();
        return *this;
    }

    ModInt operator-() const { return ModInt(-x); }

    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }

    ModInt operator+(const ll &q) const {return ModInt(*this) += (ModInt)q; }
    ModInt operator-(const ll &q) const {return ModInt(*this) -= (ModInt)q; }
    ModInt operator*(const ll &q) const {return ModInt(*this) *= (ModInt)q; }
    ModInt operator/(const ll &q) const {return ModInt(*this) /= (ModInt)q; }
    bool operator==(const ll &q) const {return x == q; }
    bool operator!=(const ll &q) const {return x != q; }

    ModInt operator++(){ if(++x == mod) x = 0; return *this; }
    ModInt operator--(){ x = (x == 0 ? mod-1 : x-1); return *this; }
    ModInt operator++(int){ const ModInt res(*this); ++*this; return res; }
    ModInt operator--(int){ const ModInt res(*this); --*this; return res; }

    ModInt inv() const {
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }

    ModInt pow(ll n, bool inv=false) const {
        ModInt ret(1), mul(x);
        while(n > 0) {
        if(n & 1) ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        if(inv) ret=ret.inv();
        return ret;
    }

    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt &a) {
        ll t;
        is >> t;
        a = ModInt< mod >(t);
        return (is);
    }
};
using mint = ModInt< MOD >;
mint mpow(ll x, ll n, bool inv=false) {
    mint ret(1), mul(x);
    while(n > 0) {
    if(n & 1) ret *= mul;
        mul *= mul;
        n >>= 1;
    }
    if(inv) ret=ret.inv();
    return ret;
}
vector<mint> powpool;
void makepow(ll num, ll pool, bool inv=false){
    mint now=1;
    if(inv) makepow((now/num).x ,pool);
    rep(i,pool+1){
        powpool.emplace_back(now);
        now*=num;
    }
}
mint poolpow(ll n){
    if(n>=powpool.size()) return powpool[1].pow(n);
    return powpool[n];
}

template<class Hono = ll, class Nono = ll> // HeadMono, NodeMono
struct graph{ // nodestate -id-> headstate
    struct edge{ll to;};
    using FuncHH = function<Hono(Hono,Hono)>;
    using FuncHN = function<Hono(Hono,Nono)>;
    // using FuncNonoNH = function<Nono(Nono,Hono)>;
    FuncHH mergehead;
    FuncHN throughnode;
    // FuncNonoNH makenodeval;
    ll N;
    vector<vector<edge> > G;
    vector<bool> used;
    vector<ll> par;
    Hono unithead;
    vector<Hono> toparhead;
    vector<Hono> fromparhead;
    vector<vector<Hono>> lsumhead;
    vector<vector<Hono>> rsumhead;
    vector<Nono> nodeinnate;
    vector<Nono> nodeval;
    ll root=-1;

    graph(ll n, Hono _unithead, FuncHH _mergehead, FuncHN _throughnode) : N(n), G(N), used(N,false), par(N,-1), unithead(_unithead), mergehead(_mergehead), throughnode(_throughnode), /*makenodeval(_makenodeval),*/ toparhead(N, _unithead), fromparhead(N, _unithead), lsumhead(N), rsumhead(N), nodeinnate(N), nodeval(N) {}

    void nodeset(ll v, Hono dat){
        nodeinnate[v]=dat;
    }

    void ade(ll s, ll t){
        G[s].emplace_back((edge){t});
        G[t].emplace_back((edge){s}); //無向ならON
    }

    void dfs1(ll v){
        used[v]=true;
        Hono suml=unithead, sumr=unithead;
        ll neigh=G[v].size();
        lsumhead[v].resize(neigh+1);
        rsumhead[v].resize(neigh+1);
        lsumhead[v][0]=unithead;
        rsumhead[v][neigh]=unithead;
        rep(i,neigh){
            auto E = G[v][i];
            if(!used[E.to]){
                par[E.to]=v;
                dfs1(E.to);
                suml=mergehead(suml,toparhead[E.to]);
            }
            lsumhead[v][i+1]=suml;
        }
        repr(i,neigh-1,0){
            auto E = G[v][i];
            if(E.to!=par[v]) {
                sumr=mergehead(sumr,toparhead[E.to]);
            }
            rsumhead[v][i]=sumr;
        }
        toparhead[v]=throughnode(sumr,nodeinnate[v]);
    }

    void dfs2(ll v){
        rep(i, G[v].size()){
            auto E = G[v][i];
            if(par[v]==E.to) continue;
            Hono head=mergehead(fromparhead[v], mergehead(lsumhead[v][i],rsumhead[v][i+1]));
            fromparhead[E.to]=throughnode(head,nodeinnate[v]);
            dfs2(E.to);
        }
    }

    void calc(){
        rep(v,N){
            // rsumhead[v][0], fromparhead[v], nodeinnate[v]
            Hono ans=mergehead(rsumhead[v][0],fromparhead[v]);
            cout<< ans.dp <<"\n";
        }
    }

    void build(ll _root=0){
        root=_root;
        dfs1(root);
        dfs2(root);
        calc();
    }
};

const ll MAX = 202020;
ll fac[MAX], finv[MAX], inv[MAX];
void cinit() { // O(nlogn)
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    reps(i, 2, MAX){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll c(int n, int k){ // 二項係数計算
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

struct HONO{
    ll kosu;
    mint dp;
};

//--MAIN-----------------------------------
void Main() {
    ll N; cin>>N;
    cinit();

    using Hono=HONO;
    using Nono=mint;
    Hono unit=(HONO){0,1};
    auto headmerge = [&](Hono a, Hono b){ return (Hono){a.kosu+b.kosu,a.dp*b.dp*c(a.kosu+b.kosu, a.kosu)}; };
    auto throughnode = [&](Hono a, Nono b){ return (Hono){a.kosu+1, a.dp}; };

    graph<Hono,Nono> g(N, unit, headmerge, throughnode);
    rep(i,N-1){
        ll a,b; cin>>a>>b; --a,--b;
        g.ade(a,b);
    }
    g.build();
    
}

//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 63216