// clang-format off
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#ifndef bhartiya
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#endif

#define int long long
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef gp_hash_table<int, int> umap;
typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update> oset;
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;

#define INF 100000000000ll
#define MOD 1000000007
#define EPS 1e-7
#define PI 3.1415926535897932385
// #define PI acos(-1)

#define pb emplace_back
#define bitc __builtin_popcountll
#define mp make_pair
#define ff first
#define ss second
#define all(ar) ar.begin(), ar.end()
#define len(x) (int)x.length()

#define fr(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define rep(i, n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define frr(i, a, b) for (int i = (a), _b = (b); i >= _b; i--)
#define foreach(it, ar) for (auto it = ar.begin(); it != ar.end(); it++)
#define fil(ar, val) memset(ar, val, sizeof(ar))  // 0x3f for inf, 0x80 for -INF can also use with pairs

#ifdef bhartiya
template<typename T>
void __p(T a) { cout << a << " "; }
template<typename T>
void __p(std::vector<T> a) { cout << "{ "; for (auto p : a) __p(p); cout << "}"; }
template<typename T, typename F>
void __p(pair<T, F> a) { cout << "{ "; __p(a.first); __p(a.second); cout << "}"; }
template<typename T, typename ...Arg>
void __p(T a1, Arg ...a) { __p(a1); __p(a...); }
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cout<<name<<" : ";__p(arg1);cout<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    int bracket=0,i=0;
    for(; ;i++)
        if(names[i]==','&&bracket==0)
            break;
        else if(names[i]=='(')
            bracket++;
        else if(names[i]==')')
            bracket--;
    const char *comma=names+i;
    cout.write(names,comma-names)<<" : ";
    __p(arg1);
    cout<<"| ";
    __f(comma+1,args...);
}
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
// #define endl '\n'
#define trace(...)
#define end_routine()
#endif

mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
inline bool equals(double a, double b) { return fabs(a - b) < 1e-9; }
ll modpow(ll b, ll e, ll mod=MOD) {
    ll ans=1; for(;e;b=b*b%mod,e/=2) if(e&1) ans=ans*b%mod; return ans; }

const int n1=2000020;
ll f[n1];
ll inv[n1];
void pre()
{
    f[0]=1;
    for(ll i=1;i<=n1-2;i++)
        f[i]=(f[i-1]*i)%MOD;
    inv[n1-2]=modpow(f[n1-2],MOD-2,MOD);
    for(ll i=n1-3;i>=0;i--)
        inv[i]=((i+1)*inv[i+1])%MOD;
}
ll ncr(ll n,ll r)
{
if(r>n)return 0;
    return (((f[n]*inv[n-r])%MOD)*inv[r])%MOD;
}
vector<ll>v[200005];
map<ll,ll>m[200005];
ll s[200005];
ll ans[200005];
ll fans[200005];
ll par[200005];
ll p[200005];
ll kx[200005];
void dfs(ll x,ll p)
{
    s[x]=1;
    for(auto z:v[x])
    {
        if(z!=p)
        {
            dfs(z,x);
            s[x]+=s[z];
        }
    }
    ll left=s[x]-1;
    ans[x]=1;
    set<ll>st;
    vector<ll>vx;
    ll kt=1;
    for(auto z:v[x])
    {
        if(z!=p)
        {
            ans[x]=ans[z]*ans[x]%MOD;
            ans[x]=ans[x]*ncr(left,s[z])%MOD;
            left-=s[z];
            st.insert(s[z]);
            vx.pb(s[z]);
            kt=kt*ans[z]%MOD;
        }
    }
    kx[x]=kt;
    // trace(kt);
    for(auto z:st)
    {
        ll han=1;
        left=s[x]-1;
        left-=z;
        // trace(left);
        m[x][z]=1;
        for(auto zz:vx)
        {
            if(zz==z&&han)
            {
                han=0;
            }
            else
            {
                m[x][z]=m[x][z]*ncr(left,zz)%MOD;
                left-=zz;
            }
        }
        // trace(z);
        // trace(x,m[x][z]);
    }
    for(auto z:v[x])
    {
        if(z!=p)
        {
            ll bt=kt*modpow(ans[z],MOD-2)%MOD;
            // trace(bt);
            // trace(m[x][s[z]]);
            par[z]=bt*m[x][s[z]]%MOD;
        }
    }
}
ll n;
void dfs1(ll x,ll pa)
{
    for(auto z:v[x])
    {
        if(z!=pa)
        {
            p[z]=p[x]*par[z]%MOD;
            p[z]=p[z]*ncr(n-s[z]-1,s[x]-1-s[z])%MOD;
            // trace(z,p[z],p[x],par[z]);
            fans[z]=ans[z]*p[z]%MOD;
            fans[z]=fans[z]*ncr(n-1,s[z]-1)%MOD;
            dfs1(z,x);
        }
    }
}
void solve() 
{
    // ll n;
    cin>>n;
    rep(i,n-1)
    {
        ll x,y;
        cin>>x>>y;
        v[x].pb(y);
        v[y].pb(x);
    }
    dfs(1,1);
    p[1]=1;
    fans[1]=ans[1];
    // for(auto z:v[1])
    {
        dfs1(1,1);
    }
    rep(i,n)
    {
        cout<<fans[i+1]<<endl;
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0), cout.precision(15);   //cout<<fixed;
#ifdef bhartiya
    cin.exceptions(cin.failbit);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t=1;
    // cin>>t;
    pre();
    fr(i,1,t)
    {
        solve();
    }
    // cout<<104*modpow(9,MOD-2)%MOD;
    end_routine();
}

Measured memory_bytes: 76032