#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <set>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <regex>
#include <cmath>
#include <map>
#include <iterator>
#include <climits>
#include <numeric>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <array>
#include <valarray>
#include <complex>
#include <random>
#include <functional>
#include <cassert>
#include <chrono>
#include <memory>

using namespace std;

#define int long long
//region TEMPLATE
////@formatter:off
#define double long double
typedef long long ll;
typedef unsigned long long ull;
template<typename T>void __read(T &a) { cin >> a; }
template<typename T, typename ... Args> void __read(T &a, Args &... args) { cin >> a;__read(args...);}
#define make(t, ...) t __VA_ARGS__; __read(__VA_ARGS__)
#define makev(a, n) VI a(n); FOR(n) cin >> a[i];
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FORIT(p) for(auto it = p.begin(); it != p.end(); it++)
#define FOR(b) for(signed i = 0; i <(b); i++)
#define FORE(i, l, r) for(int i = (l); i < (r); i++)
#define NFOR(i, n) for(int i = (((int) n)-1); i >= 0; i--)
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<pair<int, int>, int> PPII;
constexpr ll M7 = 1000000007ll;
constexpr ll M9 = 1000000009ll;
constexpr ll MFFT = 998244353ll;
template<class T> void outv(T &a) { for (auto &x : a) cout << x << ' '; }
static mt19937 rnd(static_cast<unsigned>(chrono::steady_clock::now().time_since_epoch().count())); // NOLINT(cert-err58-cpp)
auto __fast_io__ = (ios_base::sync_with_stdio(false), cin.tie(nullptr)); // NOLINT(cert-err58-cpp,cppcoreguidelines-interfaces-global-init)
////@formatter:on
//endregion

int fpow(int a, int b){
    int res = 1;
    while(b > 0){
        if (b & 1){
            res = res * a % M7;
        }
        a = a * a % M7;
        b /= 2;
    }
    return res;
}

int dv(int a, int b){
    return a * fpow(b, M7 - 2) % M7;
}

int32_t main() {
    make(int, n);
    VVI g(n);
    for(int i = 1; i < n; ++i){
        make(int, v, u);
        v--, u--;
        g[v].push_back(u);
        g[u].push_back(v);
    }
    int f = 1;
    for(int i = 2; i <= n; ++i){
        f = f * i % M7;
    }
    VI ans(n);
    VI sz(n);
    int d = 1;
    function<void(int, int)> dfs = [&](int v, int p){
        sz[v] = 1;
        for(int u : g[v]){
            if (u != p){
                dfs(u, v);
                sz[v] += sz[u];
            }
        }
        d = d * sz[v] % M7;
    };
    function<void(int, int)> calc_ans = [&](int v, int p){
        ans[v] = dv(f, d);
        for(int u : g[v]){
            if (u != p){
                d = dv(d, sz[u]);
                sz[v] -= sz[u];
                sz[u] += sz[v];
                d = d * sz[v] % M7;
                calc_ans(u, v);
                d = dv(d, sz[v]);
                sz[u] -= sz[v];
                sz[v] += sz[u];
                d = d * sz[u] % M7;
            }
        }
    };
    dfs(0, -1);
    calc_ans(0, -1);
    for(int i = 0; i < n; ++i){
        cout << ans[i] << '\n';
    }

    return 0;
}

Measured memory_bytes: 17904