#include <bits/stdc++.h>

using namespace std;

#define forn(a, e) for (int a = 0; a < (int)(e); a++)
#define forr(a, s, e) for (int a = s; a < (int)(e); a++)
#define fore(e, a) for (auto& e : a)

#ifdef LOCAL
#define logv(a) {cerr << #a << " = "; fore(e, a) {cerr << e << " ";} cerr << "\n";}
#define logvp(a) {cerr << #a << " = "; fore(e, a) {cerr << "(" << e.first << ", " << e.second << ") ";} cerr << "\n";}
#define logvv(a) {cerr << #a << " = \n"; fore(r, a) { fore(e, r) {cerr << e << " ";} cerr << "\n";} }
#define logvf(a, field) {cerr << #a"."#field << " = \n"; fore(e, a) { cerr << e.field << " ";} cerr << "\n"; }
#define logvff(a, f1, f2) {cerr << #a".{"#f1 << ", "#f2 << "} = \n"; fore(e, a) { cerr << "(" << e.f1 <<", " << e.f2 << ") ";} cerr << "\n"; }
#define logs(a) cerr << #a << " = " << (a) << "\n";
#define logss(a, b) cerr << #a << " = " << (a) << ", " << #b << " = " << (b) << "\n";
#define logp(a) cerr << #a << " = " << "(" << a.first << ", " << a.second << ")" << "\n";
#define cond(pred, stmt) if (pred) { stmt }
#else
#define logv(a)
#define logvp(a)
#define logvv(a)
#define logvf(a, field)
#define logvff(a, f1, f2)
#define logs(a)
#define logss(a, b)
#define logp(a)
#define cond(pred, stmt)
#endif

using i64 = long long;
using iip = pair<i64, i64>;
using ivec = vector<int>;
using llvec = vector<i64>;
using svec = vector<string>;
template<typename T> using vec = vector<T>;

template<typename T, typename Dim>
auto make_vec(T value, Dim dim) { return vector<T>(dim, value); }
template<typename T, typename Dim1, typename... Dim>
auto make_vec(T value, Dim1 dim1, Dim... dims) { return make_vec(make_vec(value, dims...), dim1); }

template<typename T>
bool uax(T& v, const T& newv) { if (v < newv) { v = newv; return true; } else return false; }
template<typename T>
bool uin(T& v, const T& newv) { if (v > newv) { v = newv; return true; } else return false; }

template<typename T>
istream& operator>>(istream& is, vector<T>& c) { for (auto& e : c) is >> e; return is; }

// template<typename ...T>
// istream& read(T&... args) { return (cin >> ... >> args); }

static mt19937 rande(123123);   
template<typename T>
T rand_int(T from, T to) { uniform_int_distribution<T> distr(from, to); return distr(rande); }

constexpr i64 M = 1e9+7;

i64 bpow(i64 a, i64 p) {
    if (p == 1) {
        return a;        
    }
    if (p == 0) {
        return 1;
    }

    i64 res = bpow(a, p / 2);
    res *= res;
    res %= M;

    if (p % 2) {
        res *= a;
        res %= M;
    }

    return res;
}

i64 inv(i64 a) {
    return bpow(a, M - 2);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n;
    while (cin >> n) {
        vec<ivec> g(n);

        forn(i, n - 1) {
            int u, v;
            cin >> u >> v;
            u--; v--;
            g[u].push_back(v);
            g[v].push_back(u);
        }

        llvec idp(n);
        llvec sz(n);

        llvec fact(n + 1, 1);
        llvec ifact(n + 1, 1);
        forr(i, 1, n + 1) {
            fact[i] = (fact[i - 1] * i) % M;
            ifact[i] = inv(fact[i]);
        }


        function<void(int, int)> calc = [&](int v, int p) {
            i64 s = 0;

            fore(u, g[v]) if (u != p) {
                calc(u, v);
                s += sz[u];
            }

            i64 res = fact[s];
            
            fore(u, g[v]) if (u != p) {
                res *= ifact[sz[u]];
                res %= M;
                res *= idp[u];
                res %= M;
            }

            s++;
            sz[v] = s;
            idp[v] = res;
            return;
        };

        calc(0, -1);

        llvec dp(n);
        function<void(int, int, int, int)> calcdp = [&](int v, int p, i64 pv, int psz) {
            i64 s = psz;

            i64 res = ifact[psz];
            fore(u, g[v]) if (u != p) {
                s += sz[u];
                res *= ifact[sz[u]];
                res %= M;
                res *= idp[u];
                res %= M;
            }

            res *= fact[s];
            res %= M;

            if (p != -1) {
                res *= pv;
                res %= M;
            }

            dp[v] = res;
            
            fore(u, g[v]) if (u != p) {
                i64 uv = (((res * inv(idp[u])) % M) * fact[sz[u]]) % M;
                uv *= (ifact[s] * fact[s - sz[u]]) % M;
                uv %= M;
                calcdp(u, v, uv, s - sz[u] + 1);
            }

            s++;
            return;
        };
        
        logv(idp);
        calcdp(0, -1, 1, 0);

        forn(i, n) {
            cout << dp[i] << "\n";
        }
    }
}


Measured memory_bytes: 21748