#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI acos(-1)
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
const int MOD = 1e9+ 7;
const int INF = numeric_limits<int>::max() - (int)1e8;
const ll INFLL = numeric_limits<ll>::max() - (ll)1e17;

template<int64_t mod>
struct ModInt {
    int64_t value;

    ModInt() : value(0) {}
    ModInt(int64_t x) : value(x >= 0 ? x % mod : (mod - ((-x) % mod) % mod)) {}

    ModInt &operator+=(const ModInt &input) {
        value += input.value;
        if (value >= mod) value -= mod;
        return *this;
    }    

    ModInt &operator-=(const ModInt &input) {
        value += (mod - input.value);
        if (value >= mod) value -= mod;
        return *this;
    }

    ModInt &operator*=(const ModInt &input) {
        value = value * input.value % mod;
        return *this;
    }

    ModInt &operator/=(const ModInt &input) {
        *this *= input.inverse();
        return *this;
    }

    ModInt inverse() const {
        int64_t base = value, p = mod;
        pair<int64_t, int64_t> save = {1, 0};
        while (p) {
            int64_t temp = base / p;
            swap(base -= temp * p, p);
            swap(save.first -= temp * save.second, save.second);
        }
        return ModInt(save.first);
    }

    ModInt operator-() const { return ModInt(-value); }

    ModInt operator-(const ModInt &input) const { return ModInt(*this) -= input; }

    ModInt operator+(const ModInt &input) const { return ModInt(*this) += input; }

    ModInt operator*(const ModInt &input) const { return ModInt(*this) *= input; }

    ModInt operator/(const ModInt &input) const { return ModInt(*this) /= input; }

    bool operator==(const ModInt &comparsion) const { return value == comparsion.value; }

    bool operator!=(const ModInt &comparsion) const { return value != comparsion.value; }

    friend istream &operator>>(istream &stream, ModInt &input) {
        int64_t temp;
        stream >> temp;
        input = ModInt<mod>(temp);
        return stream;
    }

    friend ostream &operator<<(ostream &stream, const ModInt &input) {
        return stream << input.value;
    }

    ModInt pow(int64_t n) const {
        ModInt ret(1), x(value);
        while (n > 0) {
            if (n and 1) ret *= x;
            x *= x;
            n >>= 1;
        }
        return ret;
    }

    static const int64_t get_mod() { return mod; }
};

using modint = ModInt<MOD>;

class Combination {
private:
    size_t combination_size;
    vector<modint> factorial, inverse, factorial_inverse;

    void combination_init() {
        factorial[0] = factorial[1] = 1;
        inverse[1] = 1;
        factorial_inverse[0] = factorial_inverse[1] = 1;
        for (size_t index = 2; index < combination_size; index++) {
            factorial[index] = factorial[index - 1] * index;
            inverse[index] = modint(0) - inverse[modint::get_mod() % index] * (modint::get_mod() / index);
            factorial_inverse[index] = factorial_inverse[index - 1] * inverse[index];
        }
    }

public:
    explicit Combination(size_t N) : combination_size(N), factorial(N), inverse(N), factorial_inverse(N) {
        combination_init();
    }

    modint P(int n, int k) const {
        if (n < 0 || k < 0) return 0;
        if (n < k) return 0;
        return factorial[n] * factorial_inverse[n - k];
    }

    modint C(int n, int k) const {
        if (k < 0) return 0;
        return P(n, k) * factorial_inverse[k];
    }

    modint H(int n, int k) const {
        if (n < 0 || k < 0) return 0;
        return k == 0 ? 1 : C(n + k - 1, k);
    }
};

// Last-Updated 2020-04-30
template<typename Data, class DP>
class ReRooting {
private:
    struct edge {
        int to;
        Data data;

        edge(int to, Data data) : to(to), data(data) {}
    };

    const size_t tree_size;
    vector<vector<edge>> graph;
    vector<vector<DP>> normal_dp, left_dp, right_dp;
    vector<DP> ans_dp;
    const function<DP(DP, DP)> merge;
    const function<DP(DP, Data)> raising;
    const DP identity_element;

    // before not size_t 
    DP dfs_normal(int now_vertex, int before = -1) {
        auto &now_dp = normal_dp[now_vertex];
        now_dp = vector<DP>(graph[now_vertex].size());
        DP sum = identity_element;
        for (auto next_edge = graph[now_vertex].begin(); next_edge != graph[now_vertex].end(); next_edge++) {
            if (next_edge-> to == before) continue;
            size_t index = distance(graph[now_vertex].begin(), next_edge);
            now_dp[index] = raising(dfs_normal(next_edge->to, now_vertex), next_edge->data);
            sum = merge(sum, now_dp[index]);
        }
        return sum;
    }

    void dfs_after(int now_vertex, int before, DP partial_tree) {
        left_dp[now_vertex] = vector<DP>(graph[now_vertex].size() + 1, identity_element);
        right_dp[now_vertex] = vector<DP>(graph[now_vertex].size() + 1, identity_element);
        for (auto next_edge = graph[now_vertex].begin(); next_edge != graph[now_vertex].end(); next_edge++) {
            size_t index = distance(graph[now_vertex].begin(), next_edge);
            if (next_edge-> to == before) normal_dp[now_vertex][index] = raising(partial_tree, graph[now_vertex][index].data);
            left_dp[now_vertex][index + 1] = merge(left_dp[now_vertex][index], normal_dp[now_vertex][index]);
        }
        for (int index = (int) graph[now_vertex].size() - 1; index >= 0; index--) {
            right_dp[now_vertex][index] = merge(normal_dp[now_vertex][index], right_dp[now_vertex][index + 1]);
        }
        for (auto next_edge = graph[now_vertex].begin(); next_edge != graph[now_vertex].end(); next_edge++) {
            size_t index = distance(graph[now_vertex].begin(), next_edge);
            if (next_edge->to == before) continue;
            // Because it is a Monoid, it can be a cumulative (sum, merge).
            dfs_after(next_edge->to, now_vertex, merge(left_dp[now_vertex][index], right_dp[now_vertex][index + 1]));
        }
        ans_dp[now_vertex] = right_dp[now_vertex][0];
    }

public:
    ReRooting(const size_t graph_size, const function<DP(DP, DP)> merge, const function<DP(DP, Data)> raising, DP identity_element)
        : tree_size(graph_size), graph(graph_size), normal_dp(graph_size), left_dp(graph_size), right_dp(graph_size), 
            ans_dp(graph_size), merge(merge), raising(raising), identity_element(identity_element) {}

    void add_edge(int source, int to, Data data) {
        graph[source].emplace_back(to, data);
        graph[to].emplace_back(source, data);
    }

    void build() {
        dfs_normal(0);
        dfs_after(0, -1, identity_element);
    }

    const DP &operator[] (const size_t vertex) const { return ans_dp[vertex]; }
};

int main() {
    size_t N;
    cin >> N;
    auto comb = Combination(N + 5);
    auto merge = [&](const pair<modint, ll> &a, const pair<modint, ll> &b) {
        return pair<modint, ll>(a.first * b.first * comb.C(a.second + b.second, a.second), a.second + b.second);
    };
    auto raising = [&](const pair<modint, ll> &a, ll b) {
        return pair<modint, ll>(a.first, a.second + b);
    };
    ReRooting<ll, pair<modint, ll>> tree(N, merge, raising, pair<modint, ll>(modint(1), 0));
    for (size_t i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        tree.add_edge(a, b, 1);
    }
    tree.build();
    for (size_t i = 0; i < N; i++) {
        cout << tree[i].first << endl;
    }
}

Measured memory_bytes: 73472