#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint operator^(const ll& t)const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

///////////////////////////
template<typename T>

struct ReRooting {
	using F = function < T(T, T)>;
	using G = function<T(T, ll)>;

	F f;//マージ
	G adnode;//頂点vの追加
	T unit;
	vector<vector<edge>> g;
	ll N;

	map<pair<ll, ll>, T> mp;

	vector<T> ans;


	void dfs(ll u, ll v) {
		T memo = unit;
		for (edge e : g[v]) {
			ll w = e.to;
			if (u == w) { continue; }
			dfs(v, w);
			memo = f(memo, mp[{v, w}]);
		}
		if (u != 0) { mp[{u, v}] = adnode(memo, v); }
	}

	void dfs2(ll u, ll v) {
		ll M = g[v].size();
		vector<T> right(M + 1, unit);
		vector<T> left(M + 1, unit);

		repn(i, M) right[i] = f(right[i - 1], mp[{v, g[v][i - 1].to}]);
		for (ll i = M - 1; i >= 0; i--) left[i] = f(left[i + 1], mp[{v, g[v][i].to}]);

		rep(i, M) {
			T memo = f(right[i], left[i + 1]);
			mp[{g[v][i].to, v}] = adnode(memo, v);
		}

		for (edge e : g[v]) {
			ll w = e.to;
			if (u == w) { continue; }
			dfs2(v, w);
		}
	}

	ReRooting(vector<vector<edge>> g0, F f0, T unit0, G adnode0) {
		g = g0;
		f = f0;
		unit = unit0;
		adnode = adnode0;

		N = g.size() - 1;//頂点数(1-indexed)
		dfs(0, 1);
		dfs2(0, 1);

		ans.assign(N + 1, unit);

		repn(v, N) {
			for (edge e : g[v]) {
				ll w = e.to;
				ans[v] = f(ans[v], mp[{v, w}]);
			}
			ans[v] = adnode(ans[v], v);
		}

	}
};

vector<mint> frac, ifrac;
void finit(ll X) {
	frac.assign(X + 1, 1);
	ifrac.assign(X + 1, 1);

	repn(i, X) {
		frac[i] = frac[i - 1] * i;
		ifrac[i] = ifrac[i - 1] / i;
	}

}

mint com(ll n, ll m) {
	if (n < 0 || m < 0 || n < m) { return 0; }
	return frac[n] * ifrac[m] * ifrac[n - m];
}

typedef pair<mint, ll> pml;

int main() {
	ll N;
	cin >> N;
	finit(N + 1);

	vector<vector<edge>> g;
	g.resize(N + 1);



	repn(i, N - 1) {
		ll a, b;
		cin >> a >> b;
		g[a].push_back({ 0,a,b,0 });
		g[b].push_back({ 0,b,a,0 });
	}

	pml unit = { 1,0 };

	function <pml(pml, ll)> adnode = [](pml a, ll b) {
		pml ret;
		ret.first = a.first;
		ret.second = a.second + 1;
		return ret;
	};

	function<pml(pml, pml)> f = [](pml a, pml b) {
		pml ret;
		ret.first = com(a.second + b.second, b.second) * a.first * b.first;
		ret.second = a.second + b.second;
		return ret;
	};

	ReRooting<pml> rt(g, f, unit, adnode);

	repn(i, N) {
		cout << rt.ans[i].first << endl;
	}

}


Measured memory_bytes: 101992