#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <stack>
#include <deque>
#include <ctime>
#include <random>
#include <cassert>
#include <cmath>
#include <climits>
#include <queue>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <chrono>

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("popcnt")
#pragma GCC target("avx2")
*/


#ifdef LOCAL
	#define dbg(x) cout << #x << " : " << x << endl;
#else 
	#define dbg(x)
#endif

#define int long long
#define fi(a,b) for (int i=a;i<b;i++)
#define fj(a,b) for (int j=a;j<b;j++)
#define fk(a,b) for (int k=a;k<b;k++)
#define fi1(a,b) for (int i=a-1;i>=b;i--)
#define fj1(a,b) for (int j=a-1;j>=b;j--)
#define fk1(a,b) for (int k=a-1;k>=b;k--)
#define fx(x,a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

template<typename T1, typename T2>inline void mine(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void maxe(T1 &x, T2 y) { if (x < y) x = y; }

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << ' ';
    return a;
}


typedef long long ll;
typedef unsigned long long ull;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;



const int MOD = 1000000007;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 200010;
const double EPS = 1e-9;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int powmod(int a, int b) {
	if (b == 0)
		return 1;
	int res = powmod(a, b / 2);
	res = res * res % MOD;
	if (b & 1)
		res = res * a % MOD;
	return res;
}

int rev(int x) {
	return powmod(x, MOD - 2);
}

int f[MX];
int f1[MX];

int C(int n, int k) {
	if (k > n || k < 0)
		return 0;
	return f[n] * f1[k] % MOD * f1[n - k] % MOD;
}

int n;
vi g[MX];
int dp[MX];
int sz[MX];
	
void dfs(int v, int p = -1) {
	dp[v] = 1;
	fx(to, g[v]) {
		if (to == p)
			continue;
		dfs(to, v);
		dp[v] = dp[v] * dp[to] % MOD * C(sz[v] + sz[to], sz[to]) % MOD;
		sz[v] += sz[to];
	}
	++sz[v];
}

int ans[MX];

void walk(int v, int p = -1) {
	ans[v] = dp[v];
	fx(to, g[v]) {
		if (to == p)
			continue;
		dp[to] = dp[v] * sz[to] % MOD * rev(n - sz[to]) % MOD;
		walk(to, v);
	}
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    f[0] = 1;
    fi(1, MX)
    	f[i] = f[i - 1] * i % MOD;
    f1[MX - 1] = powmod(f[MX - 1], MOD - 2);
    fi1(MX - 1, 0)
    	f1[i] = f1[i + 1] * (i + 1) % MOD;

    cin >> n;
    fi(0, n - 1) {
    	int a, b;
    	cin >> a >> b;
    	--a;
    	--b;
    	g[a].push_back(b);
    	g[b].push_back(a);
    }
    dfs(0);
    walk(0);
    fi(0, n)
    	cout << ans[i] << '\n';
}

Measured memory_bytes: 22512