//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <bitset>

#define ll long long
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define MOD 1000000007

#define vi vector<int>
#define vvi vector<vector<int>>
#define int long long

using namespace std;

const int MAX = 510000;

ll mod_inverse(int a,int M){
	int x=M-2;
	ll temp=a;
	ll ret=1;
	//a^(MOD-1)==1(mod MOD)を利用
	//a^-1==a^(MOD-2) (mod MOD)を繰り返し二乗法で求める

	while(x!=0){
		if(x%2==1){
			ret=(ret*temp)%M;
		}
		temp=(temp*temp)%M;
		x=x/2;
	}
	return ret;
}

long long 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;
	}
}

// 二項係数計算
long long 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;
}

int makeGraph(int x, vvi& gtemp, vvi& graph, vi& come){
	int i;

	come[x]=1;

	for(i=0;i<gtemp[x].size();i++){
		if(come[gtemp[x][i]]==1) continue;
		graph[x].push_back(gtemp[x][i]);
		makeGraph(gtemp[x][i],gtemp,graph,come);
	}

	return 0;
}


struct pret_t{
	int vertex;
	int patan;
};

pret_t search(int x,vvi& graph,vector<vector<pret_t>>& vvpret){
	int i;
	int temp;
	int sum;
	pret_t pret;
	pret_t ptemp;
	vector<pret_t> vptemp;
    
	for(i=0;i<graph[x].size();i++){
		ptemp=search(graph[x][i],graph,vvpret);
		vptemp.push_back(ptemp);
	}
	vvpret[x]=vptemp;

	pret.vertex=1;
	pret.patan=1;

	for(i=0;i<vptemp.size();i++){
		pret.vertex += vptemp[i].vertex;
	}

	temp=pret.vertex-1;

	for(i=0;i<vptemp.size();i++){
		pret.patan *= COM(temp,vptemp[i].vertex);
		pret.patan %= MOD;
		pret.patan *= vptemp[i].patan;
		pret.patan %= MOD;
		temp -= vptemp[i].vertex;
	}

	return pret;
}

int inverse(int x,pret_t prev,vi& vans,vvi& graph,vector<vector<pret_t>>& vvpret){
	int i;
	int temp;
	pret_t pret;
	pret_t ptemp;
	vector<pret_t> vptemp;

	vptemp=vvpret[x];
	if(x!=1) vptemp.push_back(prev);

	pret.vertex=1;
	pret.patan=1;

	for(i=0;i<vptemp.size();i++){
		pret.vertex += vptemp[i].vertex;
	}

	temp=pret.vertex-1;

	for(i=0;i<vptemp.size();i++){
		pret.patan *= COM(temp,vptemp[i].vertex);
		pret.patan %= MOD;
		pret.patan *= vptemp[i].patan;
		pret.patan %= MOD;
		temp -= vptemp[i].vertex;
	}

	vans[x]=pret.patan;

	for(i=0;i<graph[x].size();i++){
		ptemp.vertex = pret.vertex-vptemp[i].vertex;
		ptemp.patan = pret.patan*mod_inverse(COM(pret.vertex-1,vptemp[i].vertex),MOD);
		ptemp.patan %= MOD;
		ptemp.patan = ptemp.patan*mod_inverse(vptemp[i].patan,MOD);
		ptemp.patan %= MOD;
		inverse(graph[x][i],ptemp,vans,graph,vvpret);
	}

	return 0;
}

signed main(void)
{
	//変数の宣言
	int n,m;
	static int a[200010];
	static int b[200010];

	//よく使う変数
	int i,j,k,l;
	vector<int> vtemp;

	vvi graph;
	
	scanf("%lld",&n);
    
	for(i=0;i<n-1;i++){
		scanf("%lld %lld",&a[i],&b[i]);
		//scanf_s("%lld %lld",&a[i],&b[i]);
	}

	COMinit();
	vvi gtemp;
	vi come(n+1,0);
	for(i=0;i<=n;i++){
		graph.push_back(vtemp);
		gtemp.push_back(vtemp);
	}
	for(i=0;i<n-1;i++){
		gtemp[a[i]].push_back(b[i]);
		gtemp[b[i]].push_back(a[i]);
	}
	makeGraph(1,gtemp,graph,come);
	fill(come.begin(),come.end(),0);
    
	pret_t ptemp;
	vector<pret_t> vpret;
	vector<vector<pret_t>> vvpret(n+1,vpret);
	ptemp=search(1,graph,vvpret);
    
	vi vans(n+1,0);
	inverse(1,ptemp,vans,graph,vvpret);
	for(i=1;i<=n;i++){
		printf("%lld\n",vans[i]);
	}
	return 0;
}

Measured memory_bytes: 53788