#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


// Modint
struct Mint {
    static const long long mod = (long long)(1e9 + 7);
    long long val;

    Mint() { val = 0; }
    Mint(long long a) { val = a; verify_value(); }

    void verify_value() {
        if (val >= mod) val %= mod;
        if (val < 0) val %= mod, val += mod;
    }

    Mint pow(long long p) const {
        Mint cur = Mint(val), ret = 1;
        while (p > 0) {
            if (p & 1) ret *= cur;
            cur *= cur;
            p >>= 1LL;
        }
        return ret;
    }
    Mint inv() const {
        if (val == 0)
            std::cerr << "WARNING: inv() is called with 0." << std::endl;
        return pow(mod - 2);
    }

    Mint operator+() const { return *this; }
    Mint operator-() const { return Mint(mod - val); }

    Mint operator+=(const Mint &a) {
        val += a.val;
        if (val >= mod) val -= mod;
        return Mint(val);
    }
    Mint operator*=(const Mint &a) {
        val *= a.val;
        if (val >= mod) val %= mod;
        return Mint(val);
    }
    Mint operator-=(const Mint &a) { return *this += -a; }
    Mint operator/=(const Mint &a) { return *this *= a.inv(); }

    Mint operator++() { return *this += Mint(1); }
    Mint operator--() { return *this -= Mint(1); }
    Mint operator++(int) {
        Mint ret = *this;
        ++(*this);
        return ret;
    }
    Mint operator--(int) {
        Mint ret = *this;
        --(*this);
        return ret;
    }

    operator long long() const { return val; }
};

Mint operator+(const Mint &a, const Mint &b) {
    long long ret = a.val + b.val;
    if (ret >= Mint::mod) ret -= Mint::mod;
    return Mint(ret);
}
Mint operator*(const Mint &a, const Mint &b) {
    long long ret = a.val * b.val;
    if (ret >= Mint::mod) ret %= Mint::mod;
    return Mint(ret);
}
Mint operator-(const Mint &a, const Mint &b) { return a + (-b); }
Mint operator/(const Mint &a, const Mint &b) { return a * b.inv(); }

std::ostream &operator<<(std::ostream &out, const Mint &a) { return out << a.val; }
std::istream &operator>>(std::istream &in, Mint &a) {
    in >> a.val;
    a.verify_value();
    return in;
}

Mint pow(Mint a, long long b) {
    return a.pow(b);
}


// Combinatorics
constexpr int MAX_N = 200003;
std::vector<Mint> fact(MAX_N), inv(MAX_N);

void init_fact() {
    fact[0] = inv[0] = 1;
    for (long long i = 1; i < MAX_N; i++) {
        fact[i] = fact[i - 1] * Mint(i);
        inv[i] = fact[i].inv();
    }
}

// aCb
Mint C(int a, int b) {
    if (a < b) return 0;
    Mint res = fact[a];
    res *= inv[b];
    res *= inv[a - b];
    return res;
}

// aPb
Mint P(int a, int b) {
    if (a < b) return 0;
    return fact[a] * inv[a - b];
}

// aHb
Mint H(int a, int b) {
    if (b == 0) return 1;
    return C(a + b - 1, b);
}


class SegmentTree {
private:
    using Monoid = std::pair<Mint, int>;
    const Monoid INI = { 1, 0 };
    Monoid op(Monoid a, Monoid b) {
        int sz = a.second + b.second;
        return std::make_pair(C(sz, a.second)*a.first*b.first, sz);
    }

    int num;
    std::vector<Monoid> dat;

public:
    SegmentTree(int n_) {
        num = 1;
        while (num < n_) num *= 2;
        dat.resize(2 * num, INI);
    }

    SegmentTree(const std::vector<Monoid> &m) : SegmentTree(m.size()) {
        int n = m.size();
        for (int i = 0; i < n; i++) {
            dat[num - 1 + i] = m[i];
        }
        for (int i = num - 2; i >= 0; i--) {
            dat[i] = op(dat[2 * i + 1], dat[2 * i + 2]);
        }
    }

    // Update the k-th value (0-indexed) to a.
    void update(int k, Monoid a) {
        k += num - 1;
        dat[k] = a;
        while (k > 0) {
            k = (k - 1) / 2;
            dat[k] = op(dat[2 * k + 1], dat[2 * k + 2]);
        }
    }

    // Get the value of the range [a, b).
    // k: The index of the node.
    // [left, right): The range corresponds to the k-th node.
    // Call like getval(a, b).
    Monoid getval(int a, int b, int k = 0, int left = 0, int right = -1) {
        if (right < 0) right = num;
        if (right <= a || b <= left) return INI;
        if (a <= left && right <= b) return dat[k];
        Monoid vleft = getval(a, b, 2 * k + 1, left, left + (right - left) / 2);
        Monoid vright = getval(a, b, 2 * k + 2, left + (right - left) / 2, right);
        return op(vleft, vright);
    }
};

int main() {
    init_fact();
    int n; std::cin >> n;
    std::vector<std::vector<int>> edg(n);
    for (int i = 0; i < n - 1; i++) {
        int a, b; std::cin >> a >> b;
        a--; b--;
        edg[a].push_back(b);
        edg[b].push_back(a);
    }
    std::vector<Mint> dp(n, 1), sz(n), ans(n);
    auto dfs1 = [&](auto &self, int pos, int prev = -1) -> void {
        for (int c : edg[pos]) {
            if (c == prev) continue;
            self(self, c, pos);
            sz[pos] += sz[c];
            dp[pos] = C(sz[pos], sz[c]) * dp[pos] * dp[c];
        }
        sz[pos]++;
    };

    auto dfs2 = [&](auto &self, int pos,
            int prev = -1, std::pair<Mint, int> prevp = { -1, -1 }) -> void {
        std::vector<std::pair<Mint, int>> mem;
        for (int c : edg[pos]) {
            if (c == prev) {
                mem.emplace_back(prevp);
            }
            else {
                mem.emplace_back(dp[c], sz[c]);
            }
        }
        SegmentTree seg(mem);
        ans[pos] = seg.getval(0, mem.size()).first;
        for (int i = 0; i < (int)edg[pos].size(); i++) {
            if (edg[pos][i] == prev) continue;
            auto p = seg.getval(0, i);
            auto q = seg.getval(i + 1, mem.size());
            int sz = p.second + q.second;
            Mint v = C(sz, p.second)*p.first*q.first;
            self(self, edg[pos][i], pos, std::make_pair(v, sz + 1));
        }
    };
    dfs1(dfs1, 0);
    dfs2(dfs2, 0);
    for (int i = 0; i < n; i++) std::cout << ans[i] << std::endl;
    return 0;
}

Measured memory_bytes: 31212