#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n;
vector<int> v[N];

#define ll int
ll power(ll a, ll b, ll m = mod){if(b < 0)b += m-1; ll r = 1; while(b){if(b&1)r=(r*a)%m; a = (a*a)%m; b>>=1;}return r;}

int fact[N+10], ifact[N+10];
void pre(int N){
   fact[0] = 1;
   for (int i = 1; i <= N; ++i)
   {
      fact[i] = (i*fact[i-1])%mod;
   }
   ifact[N] = power(fact[N], -1);
   for (int i = N-1; i >= 0; --i)
   {
      ifact[i] = ((i+1)*ifact[i+1])%mod;
   }
}

int nCr(int n, int r){
   if(n < r or n < 0 or r < 0)return 0;
   return ((fact[n]*ifact[r])%mod * ifact[n-r])%mod;
}

int star_bars(int a, int b){
   return nCr(a+b, a);
}

int dpU[N], dpD[N], sz[N];
vector<int> prefDP[N];
vector<int> sufffDP[N];

vector<int> prefsz[N];
vector<int> sufffsz[N];

int merge(int dp1, int dp2, int beforeSize, int currSize){
   dp1 %= mod;
   dp2 %= mod;

   beforeSize %= mod;
   currSize %= mod;

   int ans = dp1 * dp2;
   ans %= mod;
   ans *= star_bars(beforeSize, currSize);
   ans %= mod;
   return ans;
}


void dfs(int s, int p){
   if (p != -1){
      v[s].erase(find(v[s].begin(), v[s].end(), p));
   }

   dpD[s] = 1;
   for(auto i: v[s]){
      dfs(i, s);
      dpD[s] = merge(dpD[s], dpD[i], sz[s], sz[i]);
      sz[s] += sz[i];   
      prefDP[s].push_back(dpD[s]);
      prefsz[s].push_back(sz[s]);
   }

   reverse(v[s].begin(), v[s].end());

   dpD[s] = 1;
   sz[s] = 0;
   for(auto i: v[s]){
      dpD[s] = merge(dpD[s], dpD[i], sz[s], sz[i]);
      sz[s] += sz[i];
      sufffDP[s].push_back(dpD[s]);
      sufffsz[s].push_back(sz[s]);
   }

   reverse(sufffDP[s].begin(), sufffDP[s].end());
   reverse(sufffsz[s].begin(), sufffsz[s].end());
   reverse(v[s].begin(), v[s].end());

   tr(s, prefDP[s], prefsz[s], sufffDP[s], sufffsz[s]);
   sz[s]++;
}

int ans[N];

void dfs(int s){
   
   if(s == 3)
      tr("-------------------", v[s]);
   for (int i = 0; i < (int)(v[s].size()); ++i)
   {
      int curr = v[s][i];
      int currsz = sz[1] - sz[s];
      dpU[curr] = dpU[s];

      if (i-1 >= 0){
         if(s == 3){
            tr(curr, prefDP[s][i-1], currsz, prefsz[s][i-1]);
         }
         dpU[curr] = merge(dpU[curr], prefDP[s][i-1], currsz, prefsz[s][i-1]);
         currsz += prefsz[s][i-1];
      }
      if (i + 1 < (int)(v[s].size())){
         if(s == 3){
            tr(curr, sufffDP[s][i+1], currsz, sufffsz[s][i+1]);
         }
         dpU[curr] = merge(dpU[curr], sufffDP[s][i+1], currsz, sufffsz[s][i+1]);
         currsz += sufffsz[s][i+1];
      }

      dfs(curr);
   }

   tr(s, dpD[s], dpU[s]);
   ans[s] = merge(dpD[s], dpU[s], sz[s] - 1, sz[1] - sz[s]);
}

int32_t main(){_
   
   pre(N);   
   cin>>n;

   for (int i = 0; i+1 < n; ++i)
   {
      int x, y;
      cin >> x >> y;
      v[x].push_back(y);
      v[y].push_back(x);
   }
   
   dpU[1] = 1;
   dfs(1, -1);
   tr(dpD[1], dpU[1]);
   dfs(1);

   for (int i = 1; i <= n; ++i)
   {
      cout<<ans[i]<<endl;
   }

   return 0;
}

Measured memory_bytes: 108032