//--------------------------------------------------
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,avx,avx2,popcnt,fma")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("Ofast")
//--------------------------------------------------
#include <bits/stdc++.h>
#include <chrono>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <cassert>
#include <random>
#include <bitset>
#include <iomanip>
#include <numeric>
#include <time.h>
#include <ctime>
#include <string>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <fstream>
#include <stack>
#include <cstring>
//--------------------------------------------------
#define forn(i, n) for(int i = 0; i < n; i++)
#define forw(i, n) for(int i = n-1; i >= 0; --i)
#define forns(i, n, s) for(int i = s; i < n; i++)
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
//----------------------------------------------------
using namespace std;
//----------------------------------------------------
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef long double ld;
typedef vector<ll> lnum;
typedef complex<ld> comp;
//----------------------------------------------------
const ll mod = 1e9 + 7, mod2 = 998244353;
const ld eps = 1e-6;
const ll inf = 1e18;
const int base = 1e9;
const ld PI = 3.1415926;
//----------------------------------------------------
//#define endl '\n';
#ifdef MY_DEBUG
void deb(ld x) { cerr << x << endl; };
#else
void deb(ld x){};
#endif
//----------------------------------------------------
ll dp[2*100*1000], f[2*100*1000+1], sz[2*100*1000], p[2*100*1000], n;
vector<int> edges[2*100*1000];
vector<ll> ans;
//----------------------------------------------------
unsigned int bitcount(ull val) { return __builtin_popcount(val) + __builtin_popcount(val >> 32); }

void local() {
    freopen("test.in", "r", stdin);
}

void remote() {
}

void read() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n;
    forn(i, n-1){
        int a, b;
        cin >> a >> b;
        a--;b--;
        edges[a].pb(b);
        edges[b].pb(a);
    }
}

ll binpow(ll val, ll pw){
    ll res = 1;
    while(pw > 0){
        if(pw & 1) res *= val, res %= mod;
        val = (val*val) % mod;
        pw >>= 1ull;
    }
    return res;
}

void precalc(){
    f[0] = 1;
    forns(i, n+1, 1) f[i] = (f[i-1] * i) % mod;
}

void calc(int v){
    dp[v] = 1, sz[v] = 1;
    for(const int &e : edges[v]){
        if(e != p[v]){
            p[e] = v;
            calc(e);
            sz[v] += sz[e];
            dp[v] *= dp[e], dp[v] %= mod;
            dp[v] *= binpow(f[sz[e]], mod-2), dp[v] %= mod;
        }
    }
    dp[v] *= f[sz[v]-1], dp[v] %= mod;
}

void chg(int v, int u){

    ll vsz = sz[v], usz = sz[u];
    sz[v] = vsz - usz;
    sz[u] = vsz;

    dp[v] *= binpow(f[vsz-1], mod-2), dp[v] %= mod;
    dp[v] *= f[sz[v]-1], dp[v] %= mod;
    dp[v] *= binpow(dp[u], mod-2), dp[v] %= mod;
    dp[v] *= f[usz], dp[v] %= mod;

    dp[u] *= binpow(f[usz-1], mod-2), dp[u] %= mod;
    dp[u] *= f[sz[u]-1], dp[u] %= mod;
    dp[u] *= binpow(f[sz[v]], mod-2), dp[u] %= mod;
    dp[u] *= dp[v], dp[u] %= mod;
}

void recalc(int v){

    ans[v] = dp[v];
    for(const int &e : edges[v]){
        if(e != p[v]){

            chg(v, e);
            recalc(e);
            chg(e, v);

        }
    }

}

int main() {
#ifdef MY_DEBUG
    local();
#else
    remote();
#endif
    read();

    precalc();

    p[0] = -1;
    calc(0);

    ans.resize(n);
    recalc(0);

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

Measured memory_bytes: 21876