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)

#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int mod = 1e9 + 7;
const int IMAX = 200010;
constexpr ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}
class unko {
public:
	int fac[IMAX + 1], ifac[IMAX + 1], inv[IMAX + 1];
	constexpr unko() : fac(), ifac(), inv() {
		fac[0] = 1;
		rep1(i, IMAX) fac[i] = ll(fac[i - 1]) * i % mod;
		ifac[IMAX] = modpow(fac[IMAX], mod - 2);
		for (int i = IMAX; i > 0; i--) ifac[i - 1] = ll(ifac[i]) * i % mod;
		inv[0] = 1;
		rep1(i, IMAX) inv[i] = ll(ifac[i]) * fac[i - 1] % mod;
	}
} f;

int N;
const int VN = 200000;
int to[VN * 2 + 2], ne[VN * 2 + 2], he[VN + 1];
int *kari;
int n[VN + 1];
void dfs(int v) {
	n[v]++;
	int mae = 0;
	for (int i = he[v]; i; i = ne[i]) {
		int t = to[i];
		if (n[t]) {
			if (mae) ne[mae] = ne[i];
			else he[v] = ne[i];
		}
		else {
			dfs(t);
			n[v] += n[t];
			mae = i;
		}
	}
}
void dfs2(int v) {
	for (int i = he[v]; i; i = ne[i]) {
		int t = to[i];
		n[t] = ll(n[v]) * kari[n[t]] % mod;
		dfs2(t);
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	
	cin >> N;
	int k = 2;
	rep1(i, N - 1) {
		int a, b;
		cin >> a >> b;

		to[k] = b;
		ne[k] = he[a];
		he[a] = k++;
		to[k] = a;
		ne[k] = he[b];
		he[b] = k++;
	}

	int s = N / 2 + 1;
	int saidai = 0;
	n[s]++;
	for (int i = he[s]; i; i = ne[i]) {
		int t = to[i];
		dfs(t);
		n[s] += n[t];
		chmax(saidai, n[t]);
	}

	ll tmp = 1;
	rep1(i, N) tmp = (tmp * n[i]) % mod;
	n[s] = modpow(tmp, mod - 2) * f.fac[N] % mod;

	int ka[VN + 1];
	kari = ka;
	rep1(i, saidai) kari[i] = ll(i) * f.inv[N - i] % mod;

	for (int i = he[s]; i; i = ne[i]) {
		int t = to[i];
		n[t] = ll(n[s]) * kari[n[t]] % mod;
		dfs2(t);
	}
	rep1(i, N) co(n[i]);

	Would you please return 0;
}