#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define int long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define capi(x) int x;cin>>x
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define P (1'000'000'007)

using vi = vector<int>;

template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}

using Edge = int;
using Graph = vector<vector<Edge>>;

inline int fast_pow(int x, int n, int mod) {
    long long signed res = 1;
    long long accumulation = x;
    for (int i = 0; n >> i > 0; ++ i) {
        if ((n >> i) % 2) {
            res *= accumulation;
            res %= mod;
        }
        accumulation *= accumulation;
        accumulation %= mod;
    }

    return res;
}

template<int MOD=P>
class Combination {
public:
    Combination(int n) {
        long long signed accumulation = 1;
        factorials.push_back(1);
        for (int i = 1; i <= n; ++ i) {
            accumulation *= i;
            accumulation %= MOD;
            factorials.push_back(accumulation);
        }

        int n_inv = fast_pow(factorials[n], MOD - 2, MOD);
        invs.push_back(n_inv);
        accumulation = n_inv;
        for (int i = n; i >= 2; --i) {
            accumulation *= i;
            accumulation %= MOD;
            invs.push_front(accumulation);
        }
        invs.push_front(1);
    }

    int comb(int n, int r) {
        if (r <= 0) return 1;
        long long signed res = 1ll * factorials[n] * invs[r] % MOD;
        return 1ll * res * invs[n - r] % MOD;
    }

    int perm(int n, int r) {
        long long signed res = 1ll * factorials[n] * invs[n - r] % MOD;
        return res;
    }

    std::deque<int> factorials;
    std::deque<int> invs;
};

template<int MOD=P>
struct Mod {
public:
    long long signed value;

    Mod(long long signed val): value(val % MOD) {
        if (value < 0) value += MOD;
    }

    constexpr Mod& operator+=(const Mod& other) noexcept { 
        value += other.value;
        value %= MOD;
        return *this;
    }
    constexpr Mod& operator-=(const Mod& other) noexcept {
        value -= other.value;
        if (value < 0) value += MOD;
        return *this;
    }
    constexpr Mod& operator*=(const Mod& other) noexcept {
        value *= other.value;
        value %= MOD;
        return *this;
    }

    constexpr Mod operator-() noexcept {
         return value == 0 ? 0 : MOD - value;
    }

    constexpr Mod operator+(const Mod& other) const noexcept { return Mod(*this) += other; }
    constexpr Mod operator-(const Mod& other) const noexcept { return Mod(*this) -= other; }
    constexpr Mod operator*(const Mod& other) const noexcept { return Mod(*this) *= other; }
    constexpr bool operator==(const Mod& other) const noexcept { return this->value == other.value; }
    constexpr bool operator!=(const Mod& other) const noexcept { return this->value != other.value; }
};

Combination comb(200001);

class Rerooting {
public:
    struct DP {
        int dp;
        int size;
        DP(int value, int size) : dp(value), size(size) {}
    };
    const DP identity = DP(1, 0);
    function<DP(DP, DP)> merge = [](const DP& lhs, const DP& rhs) -> DP {
        auto size = lhs.size + rhs.size;
        auto value = Mod(comb.comb(size, lhs.size)) * lhs.dp * rhs.dp;
        return DP(value.value, size);
    };
    function<DP(DP)> add_root = [](const DP& dp) -> DP {
        return DP(dp.dp, dp.size + 1);
    };
 
    vector<vector<DP>> dp;
    vector<DP> ans;
    Graph G;
 
    Rerooting(const Graph& graph) : G(graph) {
        dp.resize(graph.size());
        ans.assign(graph.size(), identity);

        dfs(0);
        bfs(0, identity);
    }
 
 private:
    DP dfs(int v, int p = -1) {
        DP x = identity;
        dp[v] = vector<DP>(G[v].size(), identity);
        for (int i = 0; i < G[v].size(); ++i) {
            if (G[v][i] == p) continue;
            dp[v][i] = dfs(G[v][i], v);
            x = merge(x, dp[v][i]);
        }
        return add_root(x);
    }
    void bfs(int v, const DP& dp_p, int p = -1) {
        int deg = G[v].size();
        for (int i = 0; i < deg; ++i) {
            if (G[v][i] == p) dp[v][i] = dp_p;
        }
        vector<DP> dp_l(deg + 1, identity), dp_r(deg + 1, identity);
        for (int i = 0; i < deg; ++i) {
            dp_l[i + 1] = merge(dp_l[i], dp[v][i]);
            dp_r[deg - 1 - i] = merge(dp_r[deg - i], dp[v][deg - 1 - i]);
        }
 
        ans[v] = add_root(dp_l[deg]);
 
        for (int i = 0; i < deg; ++i) {
            int u = G[v][i];
            if (u == p) continue;
            bfs(u, add_root(merge(dp_l[i], dp_r[i + 1])), v);
        }
    }
};

signed main() {
    capi(n);

    Graph g(n, vi());

    rep(i, n - 1) {
        int a, b;
        cin >> a >> b; --a; --b;

        g[a].push_back(b);
        g[b].push_back(a);
    }

    Rerooting re(g);

    rep(i, n) {
        cout << re.ans[i].dp << endl;
    }

    return 0;
}

Measured memory_bytes: 54320