#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int modInverse(int a, int m) 
{ 
    int m0 = m; 
    int y = 0, x = 1; 
  
    if (m == 1) 
      return 0; 
  
    while (a > 1) 
    { 
        // q is quotient 
        int q = a / m; 
        int t = m; 
  
        // m is remainder now, process same as 
        // Euclid's algo 
        m = a % m, a = t; 
        t = y; 
  
        // Update y and x 
        y = x - q * y; 
        x = t; 
    } 
  
    // Make x positive 
    if (x < 0) 
       x += m0; 
  
    return x; 
} 

vector<vector<int> >adj;
int mod=1e9+7;
int sz[200005];
int fac[200004];
int ans1[200004];
int ans2[200005];
int ans[200005];
int fina[2000005];
int dfs(int ver,int pr)
{
   sz[ver]++;
   ans1[ver]=1;
   ans2[ver]=1;
   ans[ver]=1;
   for(auto i:adj[ver])
   {
      if(i!=pr)
      {
         sz[ver]+=dfs(i,ver);
      }
   }
   for(auto i:adj[ver])
   {
      if(i!=pr)
      {
         ans[ver]=(ans[ver]*ans[i])%mod;
         ans2[ver]=(ans2[ver]*fac[sz[i]])%mod;
      }
   }
   ans1[ver]=fac[sz[ver]-1];
   ans2[ver]=modInverse(ans2[ver],mod);
   ans[ver]=(ans[ver]*ans1[ver]%mod*ans2[ver])%mod;
   return sz[ver];
}

void dfs2(int ver,int pr)
{
   for(auto i:adj[ver])
   {
      if(i!=pr)
      {
         ans[ver]=(ans[ver]*modInverse(ans[i],mod))%mod;
         ans[ver]=(ans[ver]*modInverse(fac[sz[ver]-1],mod))%mod;
         ans[ver]=(ans[ver]*fac[sz[i]])%mod;
         ans[i]=(ans[i]*modInverse(fac[sz[i]-1],mod))%mod;
         sz[ver]-=sz[i];
         sz[i]+=sz[ver];
         ans[ver]=(ans[ver]*fac[sz[ver]-1])%mod;
         ans[i]=(ans[i]*ans[ver])%mod;
         ans[i]=(ans[i]*modInverse(fac[sz[ver]],mod))%mod;
         ans[i]=(ans[i]*fac[sz[i]-1])%mod;
         fina[i]=ans[i];
         dfs2(i,ver);         
         ans[i]=(ans[i]*modInverse(ans[ver],mod))%mod;
         ans[i]=(ans[i]*modInverse(fac[sz[i]-1],mod))%mod;
         ans[i]=(ans[i]*fac[sz[ver]])%mod;
         ans[ver]=(ans[ver]*modInverse(fac[sz[ver]-1],mod))%mod;
         sz[i]-=sz[ver];
         sz[ver]+=sz[i];
         ans[i]=(ans[i]*fac[sz[i]-1])%mod;
         ans[ver]=(ans[ver]*ans[i])%mod;
         ans[ver]=(ans[ver]*modInverse(fac[sz[i]],mod))%mod;
         ans[ver]=(ans[ver]*fac[sz[ver]-1])%mod;
      }
   }
}
signed main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
   
 #ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
 #endif
 
// -------------------------------------Code starts here---------------------------------------------------------------------     

   fac[0]=1;
   for(int i=1;i<=200000;i++)
   {
      fac[i]=(fac[i-1]*i)%mod;
   }
   int n;
   cin>>n;
   adj.resize(n+1);
   int x,y;
   for(int i=0;i<n-1;i++)
   {
      cin>>x>>y;
      adj[x].push_back(y);
      adj[y].push_back(x);
   }
   dfs(1,0);
   fina[1]=ans[1];
   dfs2(1,0);
   for(int i=1;i<=n;i++)
      cout<<(fina[i])%mod<<"\n";


// -------------------------------------Code ends here------------------------------------------------------------------
     clock_t clk;
 	clk = clock();
 
    clk = clock() - clk;
 	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
 	return 0;
 }
 

Measured memory_bytes: 25456