using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	
	public void Solve(){
		
		int M = (int) 2e5 + 10;
		var fact = new mlong[M];
		var finv = new mlong[M];
		fact[0] = 1;
		for(int i=1;i<M;i++){
			fact[i] = fact[i - 1] * i;
		}
		finv[M-1] = 1 / fact[M-1];
		for(int i=M-2;i>=1;i--){
			finv[i] = finv[i + 1] * (i + 1);
		}
		
		var E = new List<int>[N];
		for(int i=0;i<N;i++){
			E[i] = new List<int>();
		}
		for(int i=0;i<N-1;i++){
			E[A[i]].Add(B[i]);
			E[B[i]].Add(A[i]);
		}
		
		int[] dep = new int[N];
		for(int i=0;i<N;i++) dep[i] = -1;
		int[] par = new int[N];
		for(int i=0;i<N;i++) par[i] = -1;
		
		var q = new Queue<int>();
		q.Enqueue(0);
		dep[0] = 0;
		while(q.Count > 0){
			var now = q.Dequeue();
			foreach(var nxt in E[now]){
				if(dep[nxt] == -1){
					dep[nxt] = dep[now] + 1;
					par[nxt] = now;
					q.Enqueue(nxt);
				}
			}
		}
		
		int[] ord = new int[N];
		for(int i=0;i<N;i++) ord[i] = i;
		Array.Sort(ord, (n, m) => dep[n].CompareTo(dep[m]));
		
		int[] cld = new int[N];
		
		// Leaf to Root 
		mlong[] dp1 = new mlong[N];
		for(int j=0;j<N-1;j++){
			int now = ord[N - 1 - j];
			mlong v = 1;
			mlong coef = 1;
			int cnt = 0;
			foreach(var nxt in E[now]){
				if(nxt == par[now]) continue;
				cnt += cld[nxt];
				coef *= finv[cld[nxt]];
				v *= dp1[nxt];
			}
			coef *= fact[cnt];
			dp1[now] = coef * v;
			cld[now] = cnt + 1;
		}
		
//Console.WriteLine(String.Join(" ", dp1));
		
		// Root to child
		mlong[] dp2 = new mlong[N];
		for(int j=0;j<N;j++){
			int now = ord[j];
			mlong v = 1;
			mlong coef = 1;
			foreach(var nxt in E[now]){
				if(nxt == par[now]){
					v *= dp2[now];
					coef *= finv[N - cld[now]];
				} else {
					v *= dp1[nxt];
					coef *= finv[cld[nxt]];
				}
			}
			foreach(var nxt in E[now]){
				if(nxt == par[now]) continue;
				dp2[nxt] = coef * fact[cld[nxt]] * fact[N - cld[nxt] - 1] * v / dp1[nxt];
			}
		}
		
//Console.WriteLine(String.Join(" ", dp2));
		
		// merge
		mlong[] ans = new mlong[N];
		for(int i=0;i<N;i++){
			int now = i;
			mlong coef = 1;
			mlong v = 1;
			foreach(var nxt in E[now]){
				if(nxt == par[now]){
					v *= dp2[now];
					coef *= finv[N - cld[now]];
				} else {
					v *= dp1[nxt];
					coef *= finv[cld[nxt]];
				}
			}
			ans[now] = coef * fact[N-1] * v;
		}
		
		Console.WriteLine(String.Join("\n", ans));
	}
	int N;
	int[] A, B;
	public Sol(){
		N = ri();
		A = new int[N-1];
		B = new int[N-1];
		for(int i=0;i<N-1;i++){
			var d = ria();
			A[i] = d[0] - 1; B[i] = d[1] - 1;
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


struct mlong {
	
	const long mod = (long) 1e9 + 7;
	long V;
	
	public mlong(long _v = 0){
		V = _v;
	}
	
	public static mlong operator+(mlong a, mlong b){
		var v0 = a.V + b.V; if(v0 >= mod) v0 -= mod;
		return new mlong(v0);
	}
	public static mlong operator-(mlong a, mlong b){
		var v0 = mod + a.V - b.V; if(v0 >= mod) v0 -= mod;
		return new mlong(v0);
	}
	public static mlong operator-(mlong b){
		var v0 = mod - b.V; if(v0 >= mod) v0 -= mod;
		return new mlong(v0);
	}
	public static mlong operator*(mlong a, mlong b){
		var v0 = a.V * b.V; if(v0 >= mod) v0 %= mod;
		return new mlong(v0);
	}
	public static mlong operator/(mlong a, mlong b){
		var v0 = a.V * inv(b.V).V; if(v0 >= mod) v0 %= mod;
		return new mlong(v0);
	}
	
	
	public static mlong inv(long x){
		long a = 0, b = 0, c = 0;
		ExtGCD(x, mod, ref a, ref b, ref c);
		return (mlong)((a + mod) % mod);
	}
	
	public static void ExtGCD(long x, long y, ref long a, ref long b, ref long c){
		long r0 = x; long r1 = y;
		long a0 = 1; long a1 = 0;
		long b0 = 0; long b1 = 1;
		long q1, r2, a2, b2;
		while(r1 > 0){
			q1 = r0 / r1;
			r2 = r0 % r1;
			a2 = a0 - q1 * a1;
			b2 = b0 - q1 * b1;
			r0 = r1; r1 = r2;
			a0 = a1; a1 = a2;
			b0 = b1; b1 = b2;
		}
		c = r0;
		a = a0;
		b = b0;
	}
	
	public static mlong ModPow(mlong a, long k){
		if(k == 0) return (mlong) 1;
		if(a == 0) return (mlong) 0;
		mlong x = a;
		mlong ret = 1;
		while(k > 0){
			if(k % 2 == 1) ret *= x;
			x *= x;
			k >>= 1;
		}
		return ret;
	}
	
	
	public static bool operator == (mlong a, mlong b){
		 return a.Equals(b);
	}
	public static bool operator != (mlong a, mlong b){
		 return !(a == b);
	}
	
	public override bool Equals(System.Object obj){
		if(obj  ==  null) return false;
		mlong p  =  (mlong) obj;
		if((System.Object) p  ==  null) return false;
		return p.V  ==  V;
	}
	public override int GetHashCode(){
		return V.GetHashCode();
	}
	
	public static implicit operator mlong(long n){
		long v = n % mod; if(v < 0) v += mod;
		return new mlong(v);
	}
	public static implicit operator mlong(int n){
		long v = n % mod; if(v < 0) v += mod;
		return new mlong(v);
	}
	public static explicit operator long(mlong n){
		return n.V;
	}
	
	public override String ToString(){
		return V.ToString();
	}
	
	
}

Measured memory_bytes: 64832