/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>

#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>

#include <cmath>
#include <numeric>
#include <random>
#include <cstring>
#include <cassert>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

// type
#include <cstdint>
#include <functional>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* ---------- Functions */
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

template <long long Modulus> class mint {
    long long a;
public:

    constexpr mint(const long long a = 0) noexcept : a((a % Modulus + Modulus) % Modulus) {}

    constexpr long long& value() noexcept {
        return a;
    }

    constexpr mint& operator +=(const mint& rhs) noexcept {
        a += rhs.a;
        if (a >= Modulus) a -= Modulus;
        return *this;
    }

    constexpr mint& operator -=(const mint& rhs) noexcept {
        a += Modulus - rhs.a;
        if (a >= Modulus) a -= Modulus;
        return *this;
    }

    constexpr mint& operator *=(const mint& rhs) noexcept {
        a = a * rhs.a % Modulus;
        return *this;
    }

    constexpr mint operator +(const mint rhs) const noexcept {
        return mint(*this) += rhs;
    }

    constexpr mint operator -(const mint rhs) const noexcept {
        return mint(*this) -= rhs;
    }

    constexpr mint operator *(const mint &rhs) const noexcept {
        return mint(*this) *= rhs;
    }

    constexpr mint pow(long long t) const noexcept {
        if (!t) return 1;
        mint<Modulus> ret = pow(t >> 1u);
        ret *= ret;
        if (t & 1) ret *= *this;
        return ret;
    }

    constexpr mint inv() const noexcept {
        return pow(Modulus - 2);
    }

    constexpr mint operator /=(const mint rhs) {
        return (*this) *= rhs.inv();
    }

    constexpr mint operator /(const mint &rhs) const noexcept {
        return mint(*this) /= rhs;
    }
};

using mi = mint<MOD>;

int powmod(int a, int p) {
    mi ret = 1;
    mi mul = a;
    while (p > 0) {
        if (p & 1) ret *= mul;
        mul = mul * mul;
        p >>= 1;
    }
    return ret.value();
}

int N;
vector<int> table[200005];
mi fac[200005];
mi rev[200005];
map<int, mi> dp[200005];
map<int, int> size[200005];

void dfs(int node, int par) {
    for (int next : table[node]) {
        if (next == par) continue;
        dfs(next, node);
    }
    mi mul = 1;
    int cnt = 0;
    for (int next : table[node]) {
        if (next == par) continue;
        cnt += size[node][next];
        mul *= dp[node][next] * powmod(fac[size[node][next]].value(), MOD-2);
    }
    mul *= fac[cnt];
    if (par == -1) return;
    dp[par][node] = mul;
}

void dfs2(int node, int par) {
    mi mul = 1;
    for (int next : table[node]) {
        mul *= dp[node][next] * powmod(fac[size[node][next]].value(), MOD-2);
    }
    for (int next : table[node]) {
        if (next == par) continue;
        dp[next][node] = mul * fac[size[node][next]] * fac[N-1-size[node][next]] * powmod(dp[node][next].value(), MOD-2);
    }
    for (int next : table[node]) {
        if (next == par) continue;
        dfs2(next, node);
    }
}

void dfs3(int node, int par) {
    int cnt = 1;
    for (int next : table[node]) {
        if (next == par) continue;
        dfs3(next, node);
    }
    for (int next : table[node]) {
        if (next == par) continue;
        cnt += size[node][next];
    }
    if (par == -1) return;
    size[par][node] = cnt;
}

void dfs4(int node, int par) {
    int sum = 1;
    for (int next : table[node]) {
        sum += size[node][next];
    }
    for (int next : table[node]) {
        if (next == par) continue;
        size[next][node] = sum - size[node][next];
    }
    for (int next : table[node]) {
        if (next == par) continue;
        dfs4(next, node);
    }
}

signed main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    fac[0] = 1;
    for (int i =1; i < 200005; i++) fac[i] = fac[i-1] * i;
    rev[200004] = powmod(fac[200004].value(), MOD-2);
    for (int i = 200003; i >= 0; i--) rev[i] = rev[i+1] * (i+1);
    cin >> N;
    for (int i = 0; i < N-1; i++) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        table[u].push_back(v);
        table[v].push_back(u);
    }

    dfs3(0, -1);
    dfs4(0, -1);
    dfs(0, -1);
    dfs2(0, -1);

    for (int i = 0; i < N; i++) {
        mi ret = 1;
        int cnt = 0;
        for (int next : table[i]) {
            ret *= dp[i][next] * powmod(fac[size[i][next]].value(), MOD-2);
            cnt += size[i][next];
        }
        ret *= fac[cnt];
        cout << ret.value() << endl;
    }

    return 0;
}

Measured memory_bytes: 86640