#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const ll inf = 1e18 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
int a[200100], b[200100];

vector<int> G[200100];
ll res[200100];
ll dp[200100];
ll sz[200100];

ll mod_pow(ll x, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = (res * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return res;
}

ll mod_inverse(ll x) {
    return mod_pow(x, mod-2);
}

const int max_n = 200100;
ll fact[max_n];
ll fact_inv[max_n];
void calc_fact() {
    fact[0] = 1;
    for (ll i = 1; i < max_n; i++)
        fact[i] = (fact[i-1] * i) % mod;
    fact_inv[max_n-1] = mod_inverse(fact[max_n-1]);
    for (ll i = max_n-2; i >= 0; i--)
        fact_inv[i] = (fact_inv[i+1] * (i+1)) % mod;
}
ll mod_comb(ll n, ll k) {
    if (n < 0 || k < 0 || n < k) return 0;
    return (fact[n] * fact_inv[k] % mod) * fact_inv[n-k] % mod;
}

void calc0(int v, int prev) {
    sz[v] = 1;
    for (int u : G[v]) {
        if (u == prev) continue;
        calc0(u, v);
        sz[v] += sz[u];
    }

    dp[v] = 1;
    ll m = sz[v] - 1;
    for (int u : G[v]) {
        if (u == prev) continue;
        dp[v] *= dp[u];
        dp[v] %= mod;
        dp[v] *= mod_comb(m, sz[u]);
        dp[v] %= mod;
        m -= sz[u];
    }
}

void calc(int v, int prev, ll c) {
    res[v] = dp[v] * c;
    res[v] %= mod;
    res[v] *= mod_comb(n-1, sz[v]-1);
    res[v] %= mod;

    int num = G[v].size();
    ll temp[num+1];
    ll sz0 = n - sz[v];
    temp[0] = c;
    for (int i = 0; i < num; i++) {
        int u = G[v][i];
        if (u == prev) {
            temp[i+1] = temp[i];
            continue;
        }
        temp[i+1] = temp[i] * dp[u];
        temp[i+1] %= mod;
        temp[i+1] *= mod_comb(sz0+sz[u], sz[u]);
        temp[i+1] %= mod;
        sz0 += sz[u];
    }

    ll sz1 = 0;
    ll temp1 = 1;
    for (int i = num-1; i >= 0; i--) {
        int u = G[v][i];
        if (u == prev) continue;
        ll temp2 = temp[i] * temp1;
        temp2 %= mod;
        temp2 *= mod_comb(n-sz[u]-1, sz1);
        temp2 %= mod;
        calc(u, v, temp2);

        sz1 += sz[u];
        temp1 *= dp[u];
        temp1 %= mod;
        temp1 *= mod_comb(sz1, sz[u]);
        temp1 %= mod;
    }
}

void solve() {
    calc_fact();
    for (int i = 0; i < n-1; i++) {
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
    }

    calc0(0, -1);
    calc(0, -1, 1);

    for (int i = 0; i < n; i++) {
        cout << res[i] << endl;
    }
}

void input() {
    cin >> n;
    for (int i = 0; i < n-1; i++) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    solve();
}


Measured memory_bytes: 25324