#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvvl(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
//typedef __int128_t lll;
using namespace std;
//-------------------------------------------------------------------
#define P 1000000007
#define N_MAX 10000000
typedef long long int ll;
ll fac[N_MAX+1];
ll inv[N_MAX+1];
ll finv[N_MAX+1];

ll comb(ll n, ll k){
  if(n<0||k<0||n<k) return 0;
  return (((fac[n]*finv[n-k])%P)*finv[k])%P;
}

void init(){
  fac[0] = finv[0] = fac[1] = finv[1] = inv[1] = 1;
  for(int i = 2; i <= N_MAX; i++){
    fac[i] = (fac[i-1]*i)%P;
    inv[i] = ((-(P/i)*inv[P%i])%P+P)%P;
    finv[i] = (finv[i-1]*inv[i])%P;
  }
}
ll pp(ll a, ll b){
  return (a * b)%P;
}
//-------------------------------------------------------------------
vvl G = vv(200001, 0, 0, ll);

vll num(200001, -1), rev(200001, -1), d(200001, 0);
vll ans(200001, 0);

ll f(ll now, ll from){
  if(num[now]!=-1) return num[now];
  ll ret = 1, k = 0;
  for(int i=0;i<G[now].size();i++){
    if(G[now][i]==from) continue;
    ret = (ret * f(G[now][i], now))%P;
    k += d[G[now][i]] + 1;
  }
  d[now] = k;
  for(int i=0;i<G[now].size();i++){
    if(G[now][i]==from) continue;
    ret = (ret * comb(k, d[G[now][i]] + 1))%P;
    k -= d[G[now][i]] + 1;
  }
  return num[now] = ret;
}
ll n;

vll merge(vll a, vll b){
  vll ret = a;
  ret[0] = (((ret[0]*b[0])%P)*comb(ret[1]+b[1], b[1]))%P;
  ret[1] += b[1];
  return ret;
}
void dfs(ll now, ll from, ll R){
  ans[now] = (comb(n-1, d[now])*((R*num[now])%P))%P;
  ll z = n-1-d[now];
  vvl x = vv(0, 2, 0, ll);
  vvl y = vv(0, 2, 0, ll);

  ll c = 0;

  for(int i=0;i<G[now].size();i++){
    if(G[now][i]==from) continue;
    x.push_back(vll{0, 0});
    ll to = G[now][i];
    if(c==0) x[c] = vll{num[to], d[to]+1};
    else x[c] = merge(x[c-1], vll{num[to], d[to]+1});
    c++;
  }

  ll t = G[now].size();
  c = 0;
  for(int i=0;i<G[now].size();i++){
    if(G[now][t-1-i]==from) continue;
    y.push_back(vll{0, 0});
    ll to = G[now][t-1-i];
    if(c==0) y[c] = vll{num[to], d[to]+1};
    else y[c] = merge(y[c-1], vll{num[to], d[to]+1});
    c++;
  }
  c = 0;
  for(int i=0;i<G[now].size();i++){
    if(G[now][i]==from) continue;
    vll A = (c==0?vll{1, 0}:x[c-1]);
    vll B = (c==y.size()-1?vll{1, 0}:y[y.size()-2-c]);
    vll C{R, z};
    /*
    std::cout << "to" << G[now][i] << endl;
    std::cout << A[0] << " " << A[1] << '\n';
    std::cout << B[0] << " " << B[1] << '\n';
    std::cout << C[0] << " " << C[1] << '\n';
    */
    A = merge(A, B);
    A = merge(A, C);
    //std::cout << A[0] << " " << A[1] << '\n';
    dfs(G[now][i], now, A[0]);
    c++;
  }
}

int main(int argc, char const *argv[]) {
  ll a, b;std::cin >> n;
  init();
  re(i, n-1) {
    std::cin >> a >> b;
    G[a].push_back(b);G[b].push_back(a);
  }
  ll root = -1;
  for(int i=1;i<=n;i++) {
    if(G[i].size()==1) {
      root = i;
      break;
    }
  }
  f(root, -1);
  dfs(root, -1, 1);
  for(int i=1;i<=n;i++) std::cout << ans[i] << '\n';
  return 0;
}


Measured memory_bytes: 287068