#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}

template<typename... Ts>
auto make_v(size_t a,Ts... ts){
        return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

template<class Monoid>
class SegmentTree{
private:
        using T = typename Monoid::T;
        const size_t n;
        vector<T> d;
        void build(){
                for(size_t b = n - 1; b > 0; b--) d[b] = Monoid::op(d[b << 1], d[b << 1 | 1]);
        }

public:
        SegmentTree(size_t n)
                : n(n), d(2 * n, Monoid::identify()) {}

        template<typename InputItr>
                SegmentTree(InputItr first, InputItr last)
                : n(distance(first, last)), d(2 * n, Monoid::identify()){
                        copy(first, last, next(d.begin(), n));
                        build();
                }

        /* set one value */
        void modify(size_t k, T v){
                for(d[k += n] = v; k > 1; k >>= 1) d[k >> 1] = Monoid::op(d[k], d[k ^ 1]);
        }

        /* return [l, r) value */
        T query(size_t l, size_t r){
                T res {Monoid::identify()};
                for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
                        if (l&1) res = Monoid::op(res, d[l++]);
                        if (r&1) res = Monoid::op(res, d[--r]);
                }
                return res;
        }
};

/* Range Sum Query */
template<typename U = ll>
struct RSQ{
        using T = U;
        static T op(const T& a, const T& b){ return a + b; };
        static constexpr T identify(){ return T(0); };
};

/* Range Min Query */
template<typename U = ll>
struct RMQ{
        using T = U;
        static T op(const T& a, const T& b){ return min<T>(a, b); };
        static constexpr T identify(){ return numeric_limits<T>::max(); };
};

constexpr int default_mod = 1e9 + 7;
constexpr bool default_isPrime = true;

template<int Mod = default_mod, bool IsPrime = default_isPrime>
class mint {
        ll n_;
public:
        constexpr mint(ll n): n_{n} { 
                if (n >= Mod) {
                        n_ %= Mod;
                } else {
                        n_ = (n_ % Mod + Mod) % Mod;
                }
        }

        constexpr mint() : n_{0} {}

        constexpr operator int() const { return n_; }
        constexpr operator ll() const { return n_; }

        constexpr mint& operator==(const mint& n) {
                return n_ == n.n_;
        }

        constexpr mint& operator=(const mint& n) {
                n_ = n.n_;
                return *this;
        }

        constexpr mint& operator+=(const mint& n) {
                if ((n_ += n.n_) >= Mod) n_ -= Mod;
                return *this;
        }

        constexpr mint& operator-=(const mint& n) {
                if ((n_ -= n.n_) < 0) n_ += Mod;
                return *this;
        }
        
        constexpr mint& operator*=(const mint& n) {
                if ((n_ *= n.n_) >= Mod) n_ %= Mod;
                return *this;
        }

        constexpr mint& operator/=(const mint& n) {
                return *this *= n.inverse();
        }

        constexpr typename enable_if<IsPrime, mint>::type inverse() const {
                ll a = n_, b = Mod, u = 1, v = 0;
                while (b) {
                        ll t = a / b;
                        a -= t * b; swap(a, b);
                        u -= t * v; swap(u, v);
                }
                return mint(u);
        }

        constexpr mint operator+(mint n) const { return mint(*this) += n; }
        constexpr mint operator-(mint n) const { return mint(*this) -= n; }
        constexpr mint operator*(mint n) const { return mint(*this) *= n; }
        constexpr mint operator/(mint n) const { return mint(*this) /= n; }

};

template<int Mod = default_mod, bool IsPrime = default_isPrime>
ostream& operator<<(ostream& os, mint<Mod, IsPrime> const& n) {
        os << (int)n;
        return os;
}

using mi = mint<>;
using graph = vector<vector<int>>;

int main() {
        int n;
        cin >> n;

        graph g(n);
        rep (i, n-1) {
                int a, b;
                cin >> a >> b;
                --a; --b;
                g[a].push_back(b);
                g[b].push_back(a);
        }

        vector<mi> p(1e6);
        p[0] = mi(1);
        for (int i = 1; i < 1e6; i++) p[i] = p[i-1] * mi(i);

        vector<mi> t(n, mi(1));
        vector<int> c(n, 1);
        function<int(int, int)> rec1 = [&](int v, int bv) {
                for (int u : g[v]) {
                        if (u == bv) continue;
                        int us = rec1(u, v);
                        t[v] *= t[u] / p[us];
                        c[v] += us;
                }
                t[v] *= p[c[v]-1];

                return c[v];
        };

        rec1(0, -1);

        vector<mi> ans(n);
        vector<int> d(n, -1);
        ans[0] = t[0];
        d[0] = c[0];
        function<void(int, int)> rec2 = [&](int v, int bv) {
                for (int u : g[v]) {
                        if (u == bv) continue;
                        mi inv = (p[n-c[u]-1] / p[n-1]) * p[c[u]];
                        ans[u] = (p[n-1] / p[c[u]-1]) * (ans[v] * inv / p[n-c[u]]);
                        rec2(u, v);
                }
        };

        rec2(0, -1);

        rep (i, n) cout << ans[i] << endl;

        return 0;
}


Measured memory_bytes: 26484