#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define db(x) (cerr << #x << ": " << (x) << '\n')
#define cps CLOCKS_PER_SEC
#define tests(t) int t; cin >> t; while(t--)
#define iceil(n, x) (((n) + (x) - 1) / (x))
#define eb emplace_back
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define sz size()
#define all(v) (v).begin(), (v).end()
#define uni(v) sort(all(v)), (v).erase(unique(all(v)), (v).end())
#define fi first
#define se second
#define bitcount(x) __builtin_popcount(x)
#define bit(x) (1LL << x)
#define PI acos(-1.0)
#define EPS 1e-9

#define mod 1000000007
#define maxn 200005

using namespace std;

using namespace __gnu_pbds;
template<class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
///All indexing is 0-based
///methods: find_by_order(k); & order_of_key(k);
///To make it an ordered_multiset, use pairs of (value, time_of_insertion)
///to distinguish values which are similar

typedef long long ll;
typedef double ld;
typedef pair<ll, ll> par;

ll Dp[maxn],chij[maxn],a,b,f[maxn],N,sol[maxn],band=2,ant[maxn];
vector<int> G[maxn];

ll pot(ll b, ll e)
{
    if(e==0)
        return 1;
    if(e & 1)
        return b*pot(b,e-1)%mod;
    ll ret= pot(b,e/2);
    return ret*ret%mod;
}

ll inv(ll a)
{
    return pot(a , mod - 2);
}

void prec(int nod,int pad)
{
    Dp[nod] = chij[nod] = 1;
    ll div = 1;
    for(auto ady:G[nod]){
        if(ady == pad)
            continue;
        prec(ady,nod);
        chij[nod]+=chij[ady];
        Dp[nod] = Dp[nod]*Dp[ady]%mod;
        div = div*f[chij[ady]]%mod;
    }
    Dp[nod] =Dp[nod]*f[ chij[nod]-1 ]%mod;
    Dp[nod] = Dp[nod]*inv(div) %mod;
}

void dfs(int nod,int pad)
{
    for(auto ady:G[nod]){
        if(ady == pad)
            continue;

        ant[nod] = Dp[nod];
        Dp[nod] = Dp[nod] * f[ chij[ ady ]] %mod;
        Dp[nod] = Dp[nod] * inv(Dp[ady]) % mod;

        Dp[nod] = Dp[nod] * inv(f[N - 1] ) % mod;
        Dp[nod] = Dp[nod] * (f[N - chij[ady] - 1] ) % mod;

        Dp[ady] = Dp[ady] * Dp[nod] % mod;
        Dp[ady] = Dp[ady] * inv(f[ chij[ ady ]-1 ] )%mod;
        Dp[ady] = Dp[ady] * f[N - 1] %mod;
        Dp[ady] = Dp[ady] * inv(f[N - chij[ady]]) %mod;

        ant[ady] =
        sol[ady] = Dp[ady];
        dfs(ady,nod);

        Dp[ady] = Dp[ady] * (f[N-chij[ady]]) %mod;
        Dp[ady] = Dp[ady] * inv(f[N - 1]) %mod;
        Dp[ady] = Dp[ady] * (f[ chij[ ady ]-1] )%mod;
        Dp[ady] = Dp[ady] * inv(Dp[nod]) % mod;

        Dp[nod] = Dp[nod] * inv(f[N - chij[ady] - 1] ) % mod;
        Dp[nod] = Dp[nod] * (f[N - 1]) % mod;

        Dp[nod] = Dp[nod] * Dp[ady] % mod;
        Dp[nod] = Dp[nod] * inv( f[ chij[ady] ]) %mod;
        if(ant[nod]!=Dp[nod])
            band/=0;

    }
}

int main()
{
    #ifdef acm
    freopen("a.in","r",stdin);
    #endif // acm
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> N;

    f[0]=1;
    for(int i=1;i<N;i++){
        cin >> a >> b;
        G[a].pb(b);
        G[b].pb(a);
        f[i] = f[i-1]*i%mod;
    }

    prec(1,-1);

    sol[1] = Dp[1];

    dfs(1,-1);

    for(int i=1;i<=N;i++)
        cout << sol[i] << "\n";


}


Measured memory_bytes: 21748