#include<bits/stdc++.h>
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define popcnt(x) __builtin_popcount(x)
#define inf 0x3f3f3f3f
#define watch(x) cout << (#x) << " is " << (x) << endl
#define rand() (rand() << 15 | rand())
using namespace std;
typedef long long  ll;
#define EPS 1e-9
#define PI acos(-1.0)
int dx[] = {0 , 0 , 1 , -1 , 1 , 1 , -1 , -1};
int dy[] = {1 ,-1 , 0 , 0 , -1 , 1 ,  1 , -1};
const int N = 2e5 + 4, MOD = 1e9 + 7;
int n , down[N] , up[N] , sz[N];
vector<int> adj[N];
int fact[N] , invfact[N];

int mul(int a , int b , int m = MOD){
   return (1LL * (a % m) * (b % m)) % m;
}

int add(int a , int b , int m = MOD){
   return (1LL * (a % m) + (b % m)) % m;
}

int powMOD(int x , int n , int m = MOD){
   if(!n)return 1;
   int ret = 1;
   if(n & 1)ret = mul(x , powMOD(x , n - 1 , m) , m);
   else{
      int y = powMOD(x , n / 2 , m);
      ret = mul(y , y , m);
   }
   return ret;
}

int modinverse(int y){
   return powMOD(y , MOD - 2);
}

int inv[N];
void calcMODInv(){      // in O(N)
   inv[0] = inv[1] = 1;
   for (int i = 2; i < N ; i++) {
      inv[i] = (MOD - 1ll * (MOD / i) * inv[MOD % i] % MOD + MOD) % MOD;
   }
}

int nCr(int n , int r){
   if(r < 0 || r > n)return 0;
   return mul(mul(fact[n] , invfact[r] , MOD) , invfact[n - r] , MOD);
}

void pre(){
   calcMODInv();
   fact[0] = invfact[0] = 1;
   for(int i = 1 ; i < N ; ++i)
      fact[i] = mul(i % MOD , fact[i - 1] , MOD);

   invfact[N - 1] = powMOD(fact[N - 1] , MOD - 2 , MOD);
   for(int i = N - 2; ~i ; --i)
      invfact[i] = mul(invfact[i + 1] , (i + 1) % MOD , MOD);
}

int starsandbars(int n1 , int n2){
   return nCr(n1 + n2 , n2);
}
vector<int> suff[N] , suffRes[N];
void dfs_down(int u , int p){
   down[u] = 1;
   sz[u] = 0;
   if(p != -1)adj[u].erase(find(all(adj[u]) , p));
   suff[u].resize(adj[u].size());
   suffRes[u].resize(adj[u].size());
   for(int i = 0 ; i < (int)adj[u].size() ; ++i){
      int c = adj[u][i];
      dfs_down(c , u);
      down[u] = mul(down[u] , mul(down[c] , starsandbars(sz[u] , sz[c])));
      sz[u] += sz[c];
      suff[u][i] = sz[u];
      suffRes[u][i] = down[u];
   }
   sz[u]++;
   reverse(all(suff[u]));
   reverse(all(suffRes[u]));
   reverse(all(adj[u]));
}
/**
 * up[c] = up[u];
      int cursz = n - sz[u] , curres = 1 , sum = 0;
      if(i + 1 != (int)adj[u].size()){
         up[c] = mul(up[c] , mul(suffRes[u][i + 1] , starsandbars(suff[u][i + 1] , cursz)));
         cursz += suff[u][i + 1];
      }
      if(i != 0){
         up[c] = mul(up[c] , mul(curres , starsandbars(cursz , sum)));
      }
 */
int res[N];
void dfs_up(int u , int p){
   if(p == -1)up[u] = 1;
   res[u] = mul(down[u] , mul(up[u] , starsandbars(n - sz[u] , sz[u] - 1)));
   int dnow = 1 , sum = 0;
   for(int i = 0 ; i < (int)adj[u].size() ; ++i){
      int c = adj[u][i];
      int curres = up[u] , cursum = n - sz[u];
      if(i != 0){
         curres = mul(curres , mul(dnow , starsandbars(cursum , sum)));
         cursum += sum;
      }
      if(i + 1 != adj[u].size()){
         curres = mul(curres , mul(suffRes[u][i + 1] , starsandbars(cursum , suff[u][i + 1])));
         cursum += sum;
      }
      up[c] = curres;
      dfs_up(c , u);
      dnow = mul(dnow , mul(down[c] , starsandbars(sum, sz[c])));
      sum += sz[c];
   }
}
int main() {
   ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
   pre();
   cin >> n;
   for(int i = 1 ; i < n ; ++i){
      int u , v;
      cin >> u >> v;
      adj[u].pb(v);
      adj[v].pb(u);
   }
   dfs_down(1 , -1);
   dfs_up(1 , -1);
//   for(int i = 1 ; i <= n ; ++i)
//      cout << i << " = " << down[i] << ' ' << up[i] << "\n";
   for(int i = 1 ; i <= n ; ++i)
      cout << res[i] << "\n";
}

Measured memory_bytes: 36096