#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
#define t1(x)             cerr<<#x<<"="<<x<<endl
#define t2(x, y)          cerr<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define t3(x, y, z)       cerr<<#x<<"=" <<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define t4(a,b,c,d)       cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<endl
#define t5(a,b,c,d,e)     cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<endl
#define t6(a,b,c,d,e,f)   cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<" "<<#f<<"="<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define tr(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fastio() ios::sync_with_stdio(0);cin.tie(0)
#define MEMS(x,t) memset(x,t,sizeof(x));
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
/*-------------------------------------------------------------------------------------------------------------------------------------*/
#define MOD 1000000007
#define endl "\n" 
#define int long long
#define inf 1e18
#define ld long double
/*-------------------------------------------------------------------------------------------------------------------------------------*/

ll poww(long long a, long long n, long long m)
{
        long long ans = 1;
        long long mul = a;
        while (n != 0)
        {
                if (n % 2)
                {
                        ans = (ans * mul) % m;
                }
                mul = (mul * mul) % m;
                n /= 2;
        }
        return ans;
}
/* 
Fermat's little theorem: 
1) (a/b)%mod= (a*(poww(b,mod-2,mod)))%mod iff a%b==0
2) (a^b)%mod= (a^(b%(mod-1)))%mod iff mod is prime
*/
const int SZ=2e5+100;
ll factorial[SZ];
void precompute()
{
    factorial[0]=1;
    for(int i=1;i<SZ;i++)
    {
        factorial[i]=(factorial[i-1]*i)%MOD;
    }
}
ll InverseEuler(ll n, ll m)
{
    return poww(n, m - 2, m);
}
ll C(ll n, ll r, ll m)
{

    return (factorial[n] * ((InverseEuler(factorial[r], m) * InverseEuler(factorial[n - r], m)) % m)) % m;
}

int n;
const int N=2e5+10;
vector<int> adj[N];

int dp[N];

int sz[N];
void sz_dfs(int node,int par)
{
    sz[node]=1;
    for(auto x: adj[node])
    {
        if(x==par)continue;
        sz_dfs(x,node);
        sz[node]+=sz[x];
    }
}
void dfs1(int node,int par)
{
    for(int i: adj[node])
    {
        if(i!=par)dfs1(i,node);
    }
    dp[node]=1;
    int sum=0;
    for(int i: adj[node])
    {
        if(i==par)continue;
        dp[node]*=dp[i];
        dp[node]%=MOD;
        sum+=sz[i];
        dp[node]*=InverseEuler(factorial[sz[i]],MOD);
        dp[node]%=MOD;
    }
    dp[node]*=factorial[sum];
    dp[node]%=MOD;
    // tr(node,dp[node]);
}

int ans[N];
void dfs2(int node,int par,int cur)
{
    // tr(node,par,cur);
    int c=dp[node];
    c*=InverseEuler(factorial[sz[node]-1],MOD);
    c%=MOD;
    c*=factorial[n-1];
    c%=MOD;
    c*=InverseEuler(factorial[n-sz[node]],MOD);
    c%=MOD;
    ans[node]=(c*cur)%MOD;
    for(int i: adj[node])
    {
        if(i==par)continue;
        int cc=ans[node];
        cc*=InverseEuler(dp[i],MOD);
        cc%=MOD;
        cc*=InverseEuler(factorial[n-1],MOD);
        cc%=MOD;
        cc*=factorial[n-1-sz[i]];
        cc%=MOD;
        cc*=factorial[sz[i]];
        cc%=MOD;
        dfs2(i,node,cc);
    }
}
int32_t main()
{
	fastio();
	cin>>n;
    precompute();
    for(int i=1;i<n;i++)
    {
        int u,v;
        cin>>u>>v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    sz_dfs(1,0);
    dfs1(1,0);
    dfs2(1,0,1);
    for(int i=1;i<=n;i++)
    {
        cout<<ans[i]<<endl;
    }
}


Measured memory_bytes: 20976