#include <bits/stdc++.h>

using namespace std;

template <std::uint_fast64_t Modulus> class modint {
    using u64 = std::uint_fast64_t;
    u64 a;

    public:

    template <class INT>
    constexpr modint(const INT x = 0) noexcept : a(x >= 0 ? x % Modulus : x % Modulus + Modulus) {}
    constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
    constexpr u64 &value() noexcept { return a; }
    constexpr const u64 &value() const noexcept { return a; }
    constexpr modint operator+(const modint rhs) const noexcept {
        return modint(*this) += rhs;
    }
    constexpr modint operator-(const modint rhs) const noexcept {
        return modint(*this) -= rhs;
    }
    constexpr modint operator*(const modint rhs) const noexcept {
        return modint(*this) *= rhs;
    }
    constexpr modint operator/(const modint rhs) const noexcept {
        return modint(*this) /= rhs;
    }
    constexpr modint &operator+=(const modint rhs) noexcept {
        a += rhs.a;
        if (a >= Modulus) {
            a -= Modulus;
        }
        return *this;
    }
    constexpr modint &operator-=(const modint rhs) noexcept {
        if (a < rhs.a) {
            a += Modulus;
        }
        a -= rhs.a;
        return *this;
    }
    constexpr modint &operator*=(const modint rhs) noexcept {
        a = a * rhs.a % Modulus;
        return *this;
    }
    constexpr modint &operator/=(modint rhs) noexcept {
        u64 exp = Modulus - 2;
        while (exp) {
            if (exp % 2) {
                *this *= rhs;
            }
        rhs *= rhs;
        exp /= 2;
        }
        return *this;
    }

    constexpr bool operator<(const modint& rhs) const noexcept {return this->a < rhs.a;}
    constexpr bool operator>(const modint& rhs) const noexcept {return rhs < this;}
    constexpr bool operator<=(const modint& rhs) const noexcept {return !(this > rhs);}
    constexpr bool operator>=(const modint& rhs) const noexcept {return !(this < rhs);}
    constexpr bool operator==(const modint& rhs) const noexcept {return this->a == rhs.a;}
    constexpr bool operator!=(const modint& rhs) const noexcept {return !(this == rhs);}

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

    template <std::uint_fast64_t M>
    friend constexpr std::ostream& operator<<(std::ostream& os, const modint<M>& rhs) noexcept {
        os << rhs.a;
        return os;
    }
    template <std::uint_fast64_t M>
    friend constexpr std::istream& operator>>(std::istream& is, modint<M>& rhs) noexcept {
        int64_t tmp;
        is >> tmp;
        rhs = modint(tmp);
        return is;
    }

    constexpr modint pow(const u64 k) const noexcept {
        if (k == 0)
            return 1;
        if (k % 2 == 0){
            modint res = pow(k / 2);
            return res * res;
        }
        return pow(k - 1) * modint(*this);
    }

    template <typename T>
    operator const T (){return a;}
};

template<class Modint>
class Binomial{
    vector<Modint> fact(uint64_t n){
        vector<Modint> f(n + 1);
        f[0] = 1;
        for (uint64_t i = 0; i < n; i++)
            f[i + 1] = Modint(i + 1) * f[i];
        return f;
    }

    vector<Modint> invfact(uint64_t n){
        vector<Modint> inv(n + 1);
        inv[n] = Modint(1) / f[n];
        for (uint64_t i = n; i > 0; i--)
            inv[i - 1] = inv[i] * i;
        return inv;
    }

public:
    vector<Modint> f, invf;

    Binomial(uint64_t n){
        f = fact(n);
        invf = invfact(n);
    }

    Modint binomial(int64_t a, int64_t b){
        if (a < b)
            return 0;
        if (a < 0 or b < 0)
            return 0;
        return f[a] * invf[b] * invf[a - b];
    }
};

int main(){
    int n;
    cin >> n;
    const constexpr int64_t p = 1e9 + 7;
    using mint = modint<p>;
    Binomial<mint> binom(uint64_t(2 * n));
  
    vector<vector<int>> E(n);
    for (int i = 0; i < n - 1; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        E[a].push_back(b);
        E[b].push_back(a);
    }

    vector<mint> C(n);
    auto dfs2 = [&](int i, int par, auto self) -> int{
        mint res = 1;
        for (const auto &e: E[i]){
            if (e == par)
                continue;
            res += self(e, i, self);
        }
        C[i] = res;
        return res;
    };

    dfs2(0, -1, dfs2);

    vector<mint> D(n);
    auto dfs = [&](int i, int par, auto self) -> mint{
        if (C[i] == mint(1))
            return D[i] = mint(1);
        mint res = 1;
        mint n = C[i]; n--;
        for (const auto &e: E[i]){
            if (e == par)
                continue;
            res *= binom.binomial(n, C[e]) * self(e, i, self);
            n -= C[e];
        }
        return D[i] = res;
    };

    dfs(0, -1, dfs);

    vector<mint> ans(n);
    auto dfs3 = [&](int i, int par, mint d_par, auto self) -> void{
        if (i == 0)
            ans[i] = D[i];
        else {
            ans[i] = d_par / binom.binomial(n - 1, C[i]) / D[i];
            mint m = n - 1;
            for (const auto &e: E[i]){
                if (e == par) continue;
                ans[i] *= binom.binomial(m, C[e]) * D[e];
                m -= C[e];
            }
        }
        for (const auto &e: E[i]){
            if (e == par) continue;
            self(e, i, ans[i], self);
        }
    };

    dfs3(0, -1, D[0], dfs3);

    for (int i = 0; i < n; i++)
        cout << ans[i] << endl;
}

Measured memory_bytes: 26612