#include <bits/stdc++.h>

using namespace std;

template <unsigned long long mod> class modint {
public:
	unsigned long long v;
	modint(const long long x = 0) : v(x % mod) {}
	modint operator+(const modint rhs) { return modint(*this) += rhs; }
	modint operator-(const modint rhs) { return modint(*this) -= rhs; }
	modint operator*(const modint rhs) { return modint(*this) *= rhs; }
	modint operator/(const modint rhs) { return modint(*this) /= rhs; }
	modint operator-() { return modint(mod - this->v); }
	modint& operator+=(const modint rhs) {
		v += rhs.v;
		if (v >= mod) v -= mod;
		return *this;
	}
	modint& operator-=(const modint rhs) {
		if (v < rhs.v) v += mod;
		v -= rhs.v;
		return *this;
	}
	modint& operator*=(const modint rhs) {
		v = v * rhs.v % mod;
		return *this;
	}
	modint inverse(modint a) {
		unsigned long long exp = mod - 2;
		modint ret(1ULL);
		while (exp) {
			if (exp % 2) {
				ret *= a;
			}
			a *= a;
			exp >>= 1;
		}
		return ret;
	}
	modint& operator/=(modint rhs) {
		(*this) *= inverse(rhs);
		return *this;
	}
	friend ostream& operator<<(ostream& os, modint& u) {
		os << u.v;
		return (os);
	}
	friend istream& operator>>(istream& is, modint& u) {
		is >> u.v;
		return (is);
	}
};

const int MOD = 1000000007;
using mint = modint<MOD>;

struct edge {
	int from, to;
	edge(int from, int to) : from(from), to(to) {}
};
using node = vector<edge>;
using graph = vector<node>;
void addedge(graph& g, int from, int to, bool bidirectional = false) {
	g[from].emplace_back(edge(from, to));
	if (bidirectional) g[to].emplace_back(edge(to, from));
}

const int MAX = 200005;
mint fact[MAX], invfact[MAX], inv[MAX];

void facinit() {
	fact[0] = fact[1] = 1;
	invfact[0] = invfact[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fact[i] = fact[i - 1] * i;
		inv[i] = -inv[MOD % i] * (MOD / i);
		invfact[i] = invfact[i - 1] * inv[i];
	}
}

mint nCr(int n, int r) {
	if (n < 0 || r < 0 || n < r) return mint{0};
	return fact[n] * invfact[r] * invfact[n - r];
}

class Solution {
public:
	int n;
	vector<mint> dp, dp0;
	vector<int> ch;
	pair<int, mint> dfs(graph& g, int u, int p = -1) {
		vector<pair<int, mint>> v;
		for (auto e : g[u]) {
			if (e.to != p) {
				v.push_back(dfs(g, e.to, u));
			}
		}
		int s = 0;
		mint c = 1;
		for (auto x : v) {
			s += x.first;
			c *= invfact[x.first];
			c *= x.second;
		}
		c *= fact[s];
		dp0[u] = c;
		ch[u] = s + 1;
		return {s + 1, c};
	}

	void dfs2(graph& g, int u, int p = -1, mint f = 1) {
		dp[u] = f * nCr(n - 1, ch[u] - 1) * dp0[u];
		for (auto e : g[u]) {
			if (e.to == p) continue;
			dfs2(g, e.to, u, f * dp0[u] / dp0[e.to] * fact[ch[e.to]] / fact[n - ch[u]] * fact[n - ch[e.to] - 1] / fact[ch[u] - 1]);
		}
	}

	void solve() {
		cin >> n;
		graph g(n);
		facinit();
		for (int i = 0; i < n - 1; i++) {
			int a, b;
			cin >> a >> b;
			addedge(g, a - 1, b - 1, true);
		}
		dp0 = vector<mint>(n);
		dp = vector<mint>(n);
		ch = vector<int>(n);
		dfs(g, 0);
		dfs2(g, 0);
		for (int i = 0; i < n; i++) cout << dp[i] << "\n";
		cout << "\n";

		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Measured memory_bytes: 25968