Problem:
Score : 600 points

Problem Statement

We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i.
For each k=1, ..., N, solve the problem below:

Consider writing a number on each vertex in the tree in the following manner:

First, write 1 on Vertex k.

Then, for each of the numbers 2, ..., N in this order, write the number on the vertex chosen as follows:

Choose a vertex that still does not have a number written on it and is adjacent to a vertex with a number already written on it. If there are multiple such vertices, choose one of them at random.

Find the number of ways in which we can write the numbers on the vertices, modulo (10^9+7).

Constraints

2 \leq N \leq 2 \times 10^5

1 \leq a_i,b_i \leq N

The given graph is a tree.

Input

Input is given from Standard Input in the following format:

N
a_1 b_1
:
a_{N-1} b_{N-1}

Output

For each k=1, 2, ..., N in this order, print a line containing the answer to the problem.

Sample Input 1

3
1 2
1 3

Sample Output 1

2
1
1

The graph in this input is as follows:

For k=1, there are two ways in which we can write the numbers on the vertices, as follows:

Writing 1, 2, 3 on Vertex 1, 2, 3, respectively

Writing 1, 3, 2 on Vertex 1, 2, 3, respectively

Sample Input 2

2
1 2

Sample Output 2

1
1

The graph in this input is as follows:

Sample Input 3

5
1 2
2 3
3 4
3 5

Sample Output 3

2
8
12
3
3

The graph in this input is as follows:

Sample Input 4

8
1 2
2 3
3 4
3 5
3 6
6 7
6 8

Sample Output 4

40
280
840
120
120
504
72
72

The graph in this input is as follows:

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

// Etavioxy
#include<cstdio>
#include<cctype>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<functional>
#define ll long long
#define il inline
#define rep(i,s,t) for(register int i=(s);i<=(t);i++)
#define rev_rep(i,s,t) for(register int i=(s);i>=(t);i--)
#define each(i,u) for(int i=head[u];i;i=bow[i].nxt)
#define file(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
#define pt(x) putchar(x)
using namespace std;
il int ci(){
	register char ch; int f=1;
	while(!isdigit(ch=getchar())) f=ch=='-'?-1:1;
	register int x=ch^'0';
	while(isdigit(ch=getchar())) x=(x*10)+(ch^'0');
	return f*x;
}

const int mod = 1e9+7;
enum{N=200023};

il ll qpow(ll a,ll b){
	ll ans= 1;
	for(; b; b>>=1,a=a*a%mod) if( b&1 ){
		ans= ans*a%mod;
	} return ans;
}
il ll inv(ll x){ return qpow(x,mod-2); }

struct Edge{ int nxt,to; } bow[N*2];
int head[N],tot_e;
il void add(int x,int y){
	tot_e++;
	bow[tot_e<<1]=(Edge){head[x],y};
	bow[tot_e<<1|1]=(Edge){head[y],x};
	head[y]=(head[x]=tot_e<<1)|1;
}

int fa[N],size[N];
void dfs1(int u){
	size[u] = 1;
	each(i,u){
		int v=bow[i].to;
		if( v==fa[u] ) continue;
		fa[v] = u;
		dfs1(v);
		size[u] += size[v];
	}
}
int n;
ll ans[N];
void dfs2(int u){
	if( fa[u] ){
		ans[u] = ans[fa[u]]*(n-size[u])%mod*inv(size[u])%mod;
	}
	each(i,u){
		int v=bow[i].to;
		if( v==fa[u] ) continue;
		dfs2(v);
	}
}


int main(){
	n=ci();
	rep(i,1,n-1) add(ci(),ci());
	dfs1(1);
	ans[1]=1;
	rep(i,1,n) ans[1]=ans[1]*size[i]%mod;
	dfs2(1);
	ll fac=1;
	rep(i,1,n) fac=fac*i%mod;
	rep(i,1,n) ans[i]=fac*inv(ans[i])%mod;
	rep(i,1,n) printf("%lld\n",(ans[i]+mod)%mod);
	return 0;
}