// Slower C++ solution:
#include<bits/stdc++.h>



#define fi first

#define sd second

#define lson (nd<<1)

#define rson (nd+nd+1)

#define PB push_back

#define mid (l+r>>1)

#define MP make_pair

#define SZ(x) (int)x.size()



using namespace std;



typedef long long LL;



typedef vector<int> VI;



typedef pair<int,int> PII;



inline int read(){

    int res=0, f=1;char ch=getchar();

    while(ch<'0'|ch>'9'){if(ch=='-')f=-1;ch=getchar();}

    while(ch>='0'&&ch<='9'){res=res*10+ch-'0';ch=getchar();}

    return res*f;

}



const int MAXN = 200005;



const int MOD = 1000000007;



void addmod(int& a, int b){a+=b;if(a>=MOD)a-=MOD;}

int mulmod(int a, int b){return 1ll*a*b%MOD;}



#define go(e,u) for(int e=head[u];e;e=Next[e])

int to[MAXN<<1],Next[MAXN<<1],head[MAXN],tol;



void add_edge(int u,int v){

    Next[++tol]=head[u];to[tol]=v;head[u]=tol;

    Next[++tol]=head[v];to[tol]=u;head[v]=tol;

}



int ans[MAXN];



int cnt[MAXN], pre[MAXN], tp[MAXN];



int sz[MAXN];



int fac[MAXN], inv[MAXN], n;



int powmod(int x, int y){

    int res=1;

    while(y){

        if(y&1)res=1ll*res*x%MOD;

        y>>=1;

        x=1ll*x*x%MOD;

    }



    return res%MOD;

}



void init(){

    fac[1]=fac[0]=1;

    for(int i=2;i<=n;++i)fac[i]=1ll*fac[i-1]*i%MOD;

    inv[0]=inv[1]=1;

    for(int i=2;i<=n;++i)inv[i]=1ll*MOD-1ll*MOD/i*inv[MOD%i]%MOD;

    for(int i=2;i<=n;++i)inv[i]=1ll*inv[i-1]*inv[i]%MOD;

}



int C(int n, int m){

    return 1ll*fac[n]*inv[m]%MOD*inv[n-m]%MOD;

}



void dfs1(int u, int f){

    sz[u]=1;pre[u]=1;

    go(e,u){

        int v=to[e];

        if(v==f) continue;

        dfs1(v,u);

        sz[u]+=sz[v];

        pre[u]=1ll*pre[u]*pre[v]%MOD*C(sz[u]-1,sz[v])%MOD;

    }

}



void dfs2(int u, int f){

    ans[u]=1ll*tp[u]*pre[u]%MOD*C(n-1,n-sz[u])%MOD;

    go(e,u){

        int v=to[e];

        if(v==f)continue;

        tp[v]=1ll*ans[u]*powmod(1ll*pre[v]*C(n-1,sz[v])%MOD,MOD-2)%MOD;

        dfs2(v,u);

    }

}



int main(){

    n=read();

    for(int i=1;i<n;++i){

        int u, v;

        u=read();

        v=read();

        add_edge(u,v);

    }



    init();

    dfs1(1,0);

    tp[1]=1;

    dfs2(1,0);



    for(int i=1;i<=n;++i)cout<<ans[i]<<endl;



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.059967048921491x):
#include <cstdio>

#include <algorithm>

#define LL long long

#define mod 1000000007

#define maxn 200010

using namespace std;

LL fact[maxn],inv[maxn];

int n,head[maxn],cnt,sz[maxn];//sz[u]是以u为根的子树的节点数

LL pre[maxn],ans[maxn],tp[maxn];//pre[u]是以u为根的子树的安排方式数

struct node{

	int to,next;

}e[maxn<<1];

void add_edge(int u,int v){//邻接表

	cnt++,e[cnt].to=v,e[cnt].next=head[u],head[u]=cnt;

}

LL quick_pow(LL a,LL b){//快速幂

	LL ans=1;

	while(b){

		if(b&1)ans=ans*a%mod;

		a=a*a%mod;

		b>>=1;

	}

	return ans;

}

void init(){

	int i,u,v;

	scanf("%d",&n);

	for(i=1;i<n;i++){

		scanf("%d%d",&u,&v);

		add_edge(u,v),add_edge(v,u);//无向图

	}

	fact[0]=1;

	for(i=1;i<=n;i++)fact[i]=fact[i-1]*i%mod;

	inv[n]=quick_pow(fact[n],mod-2);

	for(i=n-1;i>=0;i--)inv[i]=inv[i+1]*(i+1)%mod;

}

LL C(int a,int b){//组合数计算

	return fact[a]*inv[a-b]%mod*inv[b]%mod;

}

void dfs1(int u,int fa){

	int b,v;

	sz[u]=1,pre[u]=1;

	for(b=head[u];b;b=e[b].next){

		v=e[b].to;

		if(v==fa)continue;

		dfs1(v,u);

		sz[u]+=sz[v];

		pre[u]=pre[v]*pre[u]%mod*C(sz[u]-1,sz[v])%mod;

	}

}

void dfs2(int u,int fa){//换根dp

	int b,v;

	ans[u]=tp[u]*pre[u]%mod*C(n-1,n-sz[u])%mod;

	for(b=head[u];b;b=e[b].next){

		v=e[b].to;

		if(v==fa)continue;

		tp[v]=ans[u]*quick_pow(pre[v]*C(n-1,sz[v])%mod,mod-2)%mod;//v是下一次搜索的根,u是当前的根,tp[v]代表在以v为根时,pre[u]的值。

		dfs2(v,u);

	}

}

int main(){

	init();

	dfs1(1,0);

	tp[1]=1;

	dfs2(1,0);

	for(int i=1;i<=n;i++)printf("%lld\n",ans[i]);

	return 0;

}