#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o setconst ll MOD = 1e9+7;return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;
//2-dim:vector<vector<Type>> vv(n, vector<Type>(m, d));
//3-dim:vector<vector<vector<Type>>> vvv(n, vector<vector<Type>>(m, vector<Type>(l, d)));

const ll MOD = 1e9+7;
const int MAX = 1001001;
int N;
ll fac[MAX],finv[MAX],inv[MAX];
void COMinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        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 COM(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 Rerooting{
    /*  begin here  */
    struct DP{
        long long dp;
        int num;
        DP(long long dp_,int num_):dp(dp_),num(num_){}
    };
    const DP identity=DP(1,0);
    function<DP(DP,DP)> merge = [](DP dp_cum,DP d) -> DP{
        return DP((((dp_cum.dp*d.dp)%MOD)*COM(d.num+dp_cum.num,d.num))%MOD, dp_cum.num+d.num);
    };
    function<DP(DP)> add_root = [](DP d) -> DP{
        return DP(d.dp,d.num+1);
    };
    /*  end here   */
    struct Edge{
        int to;
    };
    using Graph=vector<vector<Edge>>;
    vector<vector<DP>> dp; //dp[i][j]:=from i number j path
    vector<DP> ans;
    Graph G;
    Rerooting(int N):G(N){
        dp.resize(N);
        ans.assign(N,identity);
    }
    void add_edge(int a,int b){
        G[a].push_back({b});
    }
    void build(){
        dfs(0);
        dfs2(0,identity);
    }
    DP dfs(int _v,int _par=-1){
        DP dp_cum=identity; //累積をとる
        int _sz=(int)G[_v].size();
        dp[_v]=vector<DP>(_sz,identity);
        for(int _i=0;_i<_sz;_i++){
            int _u=G[_v][_i].to;
            if(_u==_par) continue;
            dp[_v][_i]=dfs(_u,_v);
            dp_cum=merge(dp_cum,dp[_v][_i]);
        }
        return add_root(dp_cum);
    }
    void dfs2(int _v,const DP& dp_p,int _par=-1){
        int _sz=(int)G[_v].size();
        for(int _i=0;_i<_sz;_i++){
            if(G[_v][_i].to==_par) dp[_v][_i]=dp_p;
        }
        vector<DP> dp_l(_sz+1,identity),dp_r(_sz+1,identity);
        for(int _i=0;_i<_sz;_i++){
            dp_l[_i+1]=merge(dp_l[_i],dp[_v][_i]);
        }
        for(int _i=_sz-1;_i>=0;_i--){
            dp_r[_i]=merge(dp_r[_i+1],dp[_v][_i]);
        }
        ans[_v]=add_root(dp_l[_sz]);
        for(int _i=0;_i<_sz;_i++){
            int _u=G[_v][_i].to;
            if(_u==_par) continue;
            dfs2(_u,add_root(merge(dp_l[_i],dp_r[_i+1])),_v);
        }
    }
};

signed main(){
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    COMinit();
    cin >> N;
    Rerooting tree(N);
    rep(i,N-1){
        int x,y; cin >> x >> y;
        x--; y--;
        tree.add_edge(x, y);
        tree.add_edge(y, x);
    }
    tree.build();
    ll ans=0;
    rep(i,N){
        ans=tree.ans[i].dp;
        cout << ans << endl;
    }
}




Measured memory_bytes: 61880