#include <bits/stdc++.h>
using namespace std;
using ll = long long;

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

template <ll mod>
class modint
{
public:
    constexpr modint(ll value = 0) : _value(value >= 0 ? value % mod : (value % mod) + mod) {}

    constexpr modint operator+() const { return *this; }
    constexpr modint operator-() const { return modint(-_value); }

    constexpr modint &operator+=(const modint &rhs) {
        if ((_value += rhs._value) >= mod) _value -= mod;
        return *this;
    }
    constexpr modint &operator-=(const modint &rhs) {
        if ((_value += mod - rhs._value) >= mod) _value -= mod;
        return *this;
    }
    constexpr modint &operator*=(const modint &rhs) {
        (_value *= rhs._value) %= mod;
        return *this;
    }
    constexpr modint &operator/=(const modint &rhs) {
        *this *= rhs.inv();
        return *this;
    }
    constexpr modint operator+(const modint &rhs) const { return modint(*this) += rhs; }
    constexpr modint operator-(const modint &rhs) const { return modint(*this) -= rhs; }
    constexpr modint operator*(const modint &rhs) const { return modint(*this) *= rhs; }
    constexpr modint operator/(const modint &rhs) const { return modint(*this) /= rhs; }

    constexpr modint operator++() { *this += 1; return *this; }
    constexpr modint operator--() { *this -= 1; return *this; }
    constexpr modint operator++(int) { modint tmp = *this; ++*this; return tmp; }
    constexpr modint operator--(int) { modint tmp = *this; --*this; return tmp; }

    constexpr bool operator==(const modint &rhs) const { return _value == rhs._value; }
    constexpr bool operator!=(const modint &rhs) const { return _value != rhs._value; }

    constexpr modint inv() const {
        ll a = _value, b = mod, u = 1LL, v = 0LL;
        while (b > 0) {
            ll tmp = a / b;
            a -= tmp * b; swap(a, b);
            u -= tmp * v; swap(u, v);
        }
        return modint(u);
    }

    constexpr modint pow(ll n) const {
        modint e = *this, res = 1;
        while (n) {
            if (n & 1) res *= e;
            e *= e, n >>= 1;
        }
        return res;
    }

    friend ostream &operator<<(ostream &os, const modint &m) {
        os << m._value;
        return os;
    }

    friend istream &operator>>(istream &is, modint &m) {
        ll in;
        is >> in;
        m = modint(in);
        return is;
    }

private:
    ll _value;
};
using mint = modint<1000000007>;

class Combination
{
private:
    vector<mint> _fact, _inv_fact;
    
public:
    Combination(int size) : _fact(size + 1), _inv_fact(size + 1) {
        _fact[0] = 1;
        for (int i = 1; i <= size; i++) _fact[i] = _fact[i-1] * i;
        _inv_fact[size] = _fact[size].inv();
        for (int i = size - 1; i >= 0; i--) _inv_fact[i] = _inv_fact[i+1] * (i+1);
    }

    mint fact(int k) const {return _fact[k];}
    mint inv_fact(int k) const {return _inv_fact[k];}

    mint P(int n, int r) {
        if (r < 0 || n < r) return 0;
        else return fact(n) * inv_fact(n - r);
    }

    mint C(int n, int r) {
        if (r < 0 || n < r) return 0;
        else return fact(n) * inv_fact(r) * inv_fact(n - r);
    }

    mint H(int n, int r) {
        if (n < 0 || r < 0) return 0;
        else return r == 0 ? 1 : C(n + r - 1, r);
    }
} c(200000);

int n;
vector<int> g[200000];
int cnt[200000];
mint dp1[200000];
mint dp2[200000];

void dfs1(int now, int par = -1)
{
    for (auto &nxt: g[now]) {
        if (nxt == par) continue;
        dfs1(nxt, now);
        dp1[now] *= dp1[nxt] * c.inv_fact(cnt[nxt]);
        cnt[now] += cnt[nxt];
    }
    dp1[now] *= c.fact(cnt[now]);
    cnt[now]++;
}

void dfs2(int now, int par = -1, int d = 0)
{
    for (auto &nxt: g[now]) {
        if (nxt == par) continue;
        dp2[nxt] = dp2[now] * dp1[now] / (dp1[nxt] * c.C(cnt[now] - 1, cnt[nxt]));
        dp2[nxt] *= c.C(d + cnt[now] - cnt[nxt] - 1, d);
        dfs2(nxt, now, d + cnt[now] - cnt[nxt]);
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        int a, b; cin >> a >> b;
        a--, b--;
        g[a].emplace_back(b), g[b].emplace_back(a);
    }

    fill(dp1, dp1 + n, 1);
    dfs1(0);
    dp2[0] = 1; dfs2(0);
    for (int i = 0; i < n; i++) {
        cout << dp1[i] * dp2[i] * c.C(n - 1, cnt[i] - 1) << '\n';
    }
    return 0;
}


Measured memory_bytes: 20980