#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

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

void dfs(vector<vector<ll>> &z,ll now,vector<bool> &a,ll oya) {
    a[now] = true;
    pair<ll, ll> zan;
    zan.first = 1;
    zan.second = 1;
    for (int i = 0; i < z[now].size(); i++) {
        if (a[z[now][i]] == false) {
            dfs(z, z[now][i], a, now);
            zan.first += mp[make_pair(now, z[now][i])].first;
            zan.second *= mp[make_pair(now, z[now][i])].second;
            zan.second %= 1000000007;
        }
    }
    zan.second *= zan.first;
    zan.second %= 1000000007;
    if (now == 0)return;
    mp[make_pair(oya, now)] = zan;
    return;
}

void dfsni(vector<vector<ll>> &z, ll now, vector<bool> &a, ll oya,vector<ll> &ans) {
    a[now] = true;
    ll zans = 1;
    for (int i = 0; i < z[now].size(); i++) {
        zans *= mp[make_pair(now, z[now][i])].second;
        zans %= 1000000007;
    }
    ans[now] = zans;
    for (int i = 0; i < z[now].size(); i++) {
        if (a[z[now][i]] == false)mp[make_pair(z[now][i], now)] = make_pair(a.size() - mp[make_pair(now, z[now][i])].first, zans * modinv(mp[make_pair(now, z[now][i])].second, 1000000007) % 1000000007*(a.size()- mp[make_pair(now, z[now][i])].first) % 1000000007);
    }
    for (int i = 0; i < z[now].size(); i++) {
        if (a[z[now][i]] == false)dfsni(z, z[now][i], a, now,ans);
    }
    return;
}

int main() {
    ll n;
    cin >> n;
    vector<vector<ll>> z(n);
    for (int i = 0; i < n-1; i++) {
        ll a,b;
        cin >> a >> b;
        a--;
        b--;
        z[a].push_back(b);
        z[b].push_back(a);
    }
    vector<bool> bol(n, false);
    vector<bool> bols(n, false);
    vector<ll> ans(n);
    dfs(z, 0, bol, -1);
    dfsni(z, 0, bols, -1,ans);
    ll nowas = 1;
    for (int i = 1; i < n; i++){
        nowas *= i;
        nowas %= 1000000007;
    }
    for (int i = 0; i < n; i++) {
        cout << modinv(ans[i], 1000000007) * nowas % 1000000007 << endl;
    }
}

Measured memory_bytes: 48488