#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

template <int mod>
struct ModInt {
    ll x;
    ModInt() : x(0) {}
    ModInt(ll y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) { if((x += p.x) >= mod) x -= mod; return *this; }
    ModInt &operator-=(const ModInt &p) { if((x += mod - p.x) >= mod) x -= mod; return *this; }
    ModInt &operator*=(const ModInt &p) { x = 1LL * x * p.x % mod; return *this; }
    ModInt &operator/=(const ModInt &p) { *this *= p.inverse(); return *this; }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {
        ll a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }
    ModInt pow(ll n) const {
        ModInt ret(1), mul(x);
        while(n > 0) {
            if(n & 1) ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }
    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t;
        is >> t;
        a = ModInt<mod>(t);
        return (is);
    }
};
const int mod = 1000000007;
using mint = ModInt<mod>;

template <typename T>
struct Combination {
    vector<T> _fac, _finv, _inv;

    Combination(int n) : _fac(n+1), _finv(n+1), _inv(n+1){
        _fac[0] = _finv[n] = _inv[0] = 1;
        for (int i = 1; i <= n; ++i) _fac[i] = _fac[i-1] * i;
        _finv[n] /= _fac[n];
        for (int i = n-1; i >= 0; --i) _finv[i] = _finv[i+1] * (i+1);
        for (int i = 1; i <= n; ++i) _inv[i] = _finv[i] * _fac[i-1];
    }
    inline T fac(int k) const { return _fac[k]; }
    inline T finv(int k) const { return _finv[k]; }
    inline T inv(int k) const { return _inv[k]; }

    T perm(int n, int k) const {
        return (k < 0 || n < k) ? 0 : fac(n) * finv(n-k);
    }
    T comb(int n, int k) const {
        return (k < 0 || n < k) ? 0 : fac(n) * finv(k) * finv(n-k);
    }
};
Combination<mint> C(200010);


mint dp[200010];
int num[200010];
vector<int> G[200010];

void dfs1(int v, int p = -1){
    dp[v] = 1;

    int cnt = 0;
    for (int &nv : G[v]) {
        if (nv == p) continue;
        dfs1(nv, v);
        cnt += num[nv];
        dp[v] *= dp[nv] * C.finv(num[nv]);
    }
    dp[v] *= C.fac(cnt);
    num[v] = cnt + 1;
}

mint res[200010];
void dfs2(int v, int p = -1){
    int cnt = 0;
    res[v] = 1;
    for (int &nv : G[v]) {
        cnt += num[nv];
        res[v] *= dp[nv] * C.finv(num[nv]);
    }
    res[v] *= C.fac(cnt);

    for (int &nv : G[v]) {
        if (nv == p) continue;
        num[v] = cnt - num[nv] + 1;
        dp[v] = res[v] * C.fac(num[nv]) / dp[nv] * C.finv(cnt) * C.fac(cnt - num[nv]);
        dfs2(nv, v);
    }
}


int main(){
    int n;
    cin >> n;
    int a, b;
    for (int i = 0; i < n-1; ++i) {
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    dfs1(0);
    dfs2(0);

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



Measured memory_bytes: 23700