//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <complex>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;
constexpr ll LL_MAX = numeric_limits<ll>::max();
constexpr ull ULL_MAX = numeric_limits<ull>::max();

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a)-1; i >= (b); i--)

struct Mod {
    static uint64_t PRIME;
    struct LocalPrime {
        uint64_t backup;
        LocalPrime(uint64_t prime) { backup = exchange(Mod::PRIME, prime); }
        ~LocalPrime() { Mod::PRIME = backup; }
    };
    uint64_t value = 0;
    Mod()
    : value(0) {}
    Mod(ll v) {
        if (v >= 0) {
            value = v % PRIME;
        } else {
            value = PRIME - (-v) % PRIME;
        }
    }
    Mod operator+(const Mod& rhs) const { return Mod(*this) += rhs; }
    Mod& operator+=(const Mod& rhs) {
        value += rhs.value;
        if (value >= PRIME) {
            value -= PRIME;
        }
        return *this;
    }
    Mod operator-(const Mod& rhs) const { return Mod(*this) -= rhs; }
    Mod& operator-=(const Mod& rhs) {
        if (value < rhs.value) {
            value += PRIME;
        }
        value -= rhs.value;
        return *this;
    }
    Mod operator*(const Mod& rhs) const { return Mod(*this) *= rhs; }
    Mod& operator*=(const Mod& rhs) {
        value = (value * rhs.value) % PRIME;
        return *this;
    }
    Mod inv() const { return power(*this, PRIME - 2); }
    Mod operator/(const Mod& rhs) const { return Mod(*this) /= rhs; }
    Mod& operator/=(const Mod& rhs) {
        *this *= rhs.inv();
        return *this;
    }
    static Mod power(Mod rhs, ll exp) {
        Mod ans = 1;
        while (exp > 0) {
            if (exp % 2) {
                ans *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
        }
        return ans;
    }
};
uint64_t Mod::PRIME = 1000000007;

struct Edge {
    ll i;
    ll a;
    ll b;
    ll parent = -1;
    ll to(ll from) {
        if (from == a) {
            return b;
        } else if (from == b) {
            return a;
        } else {
            assert(false);
            return -1;
        }
    }
};
using Tree = vector<vector<Edge*>>;

ll N;

vector<Mod> fact;
vector<Mod> fact_inv;

Mod binom(ll n, ll r) {
    if (!(0 <= n && 0 <= r && r <= n)) {
        return 1;
    }
    return fact[n] * fact_inv[r] * fact_inv[n-r];
}

Mod binom(const vector<ll>& as) {
    ll sum = accumulate(as.begin(), as.end(), 0);
    Mod ans = 1;
    rep(i,0,as.size()) {
        ans *= binom(sum, as[i]);
        sum -= as[i];
    }
    return ans;
}

unordered_map<ll, Edge*> parent_edge;

void fill_parent(Tree& tree, vector<Edge>& edges, vector<bool>& visited, ll root) {
    visited[root] = true;
    for (Edge* e : tree[root]) {
        ll to = e->to(root);
        if (!visited[to]) {
            e->parent = root;
            parent_edge[to] = e;
            fill_parent(tree, edges, visited, to);
        }
    }
}

void calc_down(Tree& tree, vector<Edge>& edges, vector<ll>& node_cnt, vector<Mod>& ans, vector<Mod>& fact_prod, vector<Mod>& ans_prod, ll subtree) {
    ll edge = subtree / 2;
    ll dir = subtree % 2;
    ll root = (dir == 0) ? edges[edge].a : edges[edge].b; // to
    ll other = (dir == 0) ? edges[edge].b : edges[edge].a; // from
    assert(edges[edge].parent == other);
    vector<ll> cnts;
    Mod ans_loc = 1;
    Mod fact_prod_loc = 1;
    for (Edge* e : tree[root]) {
        ll to = e->to(root);
        if (to == other) {
            continue;
        }
        ll dir = (to < root) ? 0 : 1;
        ll subtree0 = 2 * e->i + dir;
        calc_down(tree, edges, node_cnt, ans, fact_prod, ans_prod, subtree0);
        ll cnt_loc = node_cnt[subtree0];
        cnts.push_back(cnt_loc);
        ans_loc *= ans[subtree0];
        fact_prod_loc *= fact[cnt_loc];
    }
    ans_prod[subtree] = ans_loc;
    ans_loc *= binom(cnts);
    ll cnts_sum = accumulate(cnts.begin(), cnts.end(), 0);
    node_cnt[subtree] = cnts_sum + 1;
    ans[subtree] = ans_loc;
    fact_prod[subtree] = fact_prod_loc;
}

void calc_up(Tree& tree, vector<Edge>& edges, vector<ll>& node_cnt, vector<Mod>& ans, vector<Mod>& fact_prod, ll subtree, Mod fact_prod_root, Mod ans_prod_root, vector<Mod>& ans_prod) {
    ll edge = subtree / 2;
    ll dir = subtree % 2;
    ll root = (dir == 0) ? edges[edge].a : edges[edge].b;
    assert(edges[edge].parent == root);
    if (root > 0) {
        Edge* pe = parent_edge[root];
        ll up_subtree = 2 * pe->i + ((root < pe->to(root)) ? 1 : 0);
        if (node_cnt[up_subtree] == 0) {
            calc_up(tree, edges, node_cnt, ans, fact_prod, up_subtree, fact_prod_root, ans_prod_root, ans_prod);
        }
    }
    ll subtree_inv = subtree ^ 1;
    ll cnt_loc = 0;
    cnt_loc = N - node_cnt[subtree_inv];
    node_cnt[subtree] = cnt_loc;
    Mod fact_prod_loc = 1;
    if (root == 0) {
        fact_prod_loc = fact_prod_root;
    } else {
        Edge* pe = parent_edge[root];
        ll down_subtree = 2 * pe->i + ((root < pe->to(root)) ? 0 : 1);
        fact_prod_loc *= fact_prod[down_subtree];
    }
    fact_prod_loc *= fact_inv[node_cnt[subtree_inv]];
    if (root > 0) {
        Edge* pe = parent_edge[root];
        ll up_subtree = 2 * pe->i + ((root < pe->to(root)) ? 1 : 0);
        fact_prod_loc *= fact[node_cnt[up_subtree]];
    }
    fact_prod[subtree] = fact_prod_loc;
    Mod ans_loc = 1;
    if (root == 0) {
        ans_loc = ans_prod_root;
    } else {
        Edge* pe = parent_edge[root];
        ll down_subtree = 2 * pe->i + ((root < pe->to(root)) ? 0 : 1);
        ans_loc *= ans_prod[down_subtree];
    }
    ans_loc /= ans[subtree_inv];
    if (root > 0) {
        Edge* pe = parent_edge[root];
        ll up_subtree = 2 * pe->i + ((root < pe->to(root)) ? 1 : 0);
        ans_loc *= ans[up_subtree];
    }
    ans_loc *= fact[node_cnt[subtree]-1] / fact_prod[subtree];
    ans[subtree] = ans_loc;
}

int main() {
    cin >> N;
    fact.resize(N+1);
    fact_inv.resize(N+1);
    fact[0] = 1;
    fact_inv[0] = 1;
    rep(n,1,N+1) {
        fact[n] = fact[n-1] * n;
        fact_inv[n] = fact_inv[n-1] / n;
    }
    vector<Edge> edges(N-1);
    Tree tree(N);
    rep(i,0,N-1) {
        Edge e;
        e.i = i;
        cin >> e.a >> e.b;
        e.a--;
        e.b--;
        if (e.b < e.a) {
            swap(e.a, e.b);
        }
        edges[i] = e;
        tree[e.a].push_back(&edges[i]);
        tree[e.b].push_back(&edges[i]);
    }
    {
        vector<bool> visited(N);
        fill_parent(tree, edges, visited, 0);
    }
    vector<ll> node_cnt(2 * (N-1));
    vector<Mod> ans(2 * (N-1));
    vector<Mod> fact_prod(2 * (N-1));
    vector<Mod> ans_prod(2 * (N-1));
    Mod fact_prod_root = 1;
    Mod ans_prod_root = 1;
    for (Edge* e : tree[0]) {
        ll dir = 1;
        ll subtree = 2 * e->i + dir;
        calc_down(tree, edges, node_cnt, ans, fact_prod, ans_prod, subtree);
        fact_prod_root *= fact[node_cnt[subtree]];
        ans_prod_root *= ans[subtree];
    }
    rep(i,0,N-1) {
        Edge* e = &edges[i];
        ll dir = (e->parent < e->to(e->parent)) ? 0 : 1;
        ll subtree_up = 2 * i + dir;
        calc_up(tree, edges, node_cnt, ans, fact_prod, subtree_up, fact_prod_root, ans_prod_root, ans_prod);
    }
    rep(i,0,N) {
        Mod ans_loc = 1;
        vector<ll> cnts;
        for (Edge* e : tree[i]) {
            ll to = e->to(i);
            ll dir = (to < i) ? 0 : 1;
            ll subtree = 2 * e->i + dir;
            ans_loc *= ans[subtree];
            cnts.push_back(node_cnt[subtree]);
        }
        ans_loc *= binom(cnts);
        cout << ans_loc.value << endl;
    }
}


Measured memory_bytes: 50788