#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}


const ll MOD = 1e9 + 7;

const int SZ = 412345;
ll inv[SZ];
ll fact[SZ];
ll fact_inv[SZ];
ll choose(int n, int r) {
  if (n < 0 || r < 0 || n < r) return 0;
  return fact[n] * fact_inv[n-r] % MOD * fact_inv[r] % MOD;
}

ll mod_pow(ll a, ll b, ll p) {
  ll res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % p;
    a = (a * a) % p;
    b >>= 1;
  }
  return res;
}

ll mod_inv(ll a) {
  return mod_pow(a % MOD, MOD - 2, MOD);
}

const int MAX_N = 212345;

int N;
vector<int> g[MAX_N];

vector<ll> ways[MAX_N];
vector<ll> num[MAX_N];

ll ans[MAX_N];

pair<ll, ll> dfs(int cur, int prev) {
  ll w = 1;
  ll n = 0;
  REP(i, g[cur].size()) {
    int nxt = g[cur][i];
    if (nxt != prev) {
      auto p = dfs(nxt, cur);
      ways[cur][i] = p.first % MOD;
      num[cur][i] = p.second;

      n += num[cur][i];
      w *= choose(n, num[cur][i]) * ways[cur][i] % MOD;
      w %= MOD;
    }
  }
  n++;
  return { w, n };
}

void dfs2(int cur, int prev, pair<ll, ll> val) {

  // if (cur == 1) {
  //   cout << "val=" << val << endl;
  //   pv(ALL(ways[cur]));
  //   pv(ALL(num[cur]));
  // }

  REP(i, g[cur].size()) {
    int nxt = g[cur][i];
    if (nxt == prev) {
      ways[cur][i] = val.first;
      num[cur][i] = val.second;
    }
  }

  {
    int n = 0;
    ans[cur] = 1;
    REP(i, g[cur].size()) {
      n += num[cur][i];
      ans[cur] *= choose(n, num[cur][i]);
      ans[cur] %= MOD;
      ans[cur] *= ways[cur][i];
      ans[cur] %= MOD;
    }
  }

  // if (cur == 1) {
  //   pv(ALL(ways[cur]));
  //   pv(ALL(num[cur]));
  // }

  REP(i, g[cur].size()) {
    int nxt = g[cur][i];
    if (nxt != prev) {
      ll n_ways = ans[cur] * mod_inv(ways[cur][i]) % MOD * mod_inv(choose(N - 1, num[cur][i])) % MOD;
      ll n_num = N - num[cur][i];
      dfs2(nxt, cur, make_pair(n_ways, n_num));
    }
  }

}

int main2() {
  REP(i, MAX_N) g[i].clear();
  REP(i, MAX_N) ways[i].clear();
  REP(i, MAX_N) num[i].clear();

  N = nextInt();
  REP(i, N - 1) {
    int a = nextInt() - 1;
    int b = nextInt() - 1;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  REP(i, N) ways[i].resize( g[i].size() );
  REP(i, N) num[i].resize( g[i].size() );

  dfs(0, -1);
  dfs2(0, -1, {0, 0});

  REP(i, N) {
    ans[i] %= MOD;
    printf("%d\n", (int)ans[i]);
  }
  return 0;
}

int main() {
  inv[1] = 1;
  for (int i = 2; i < SZ; i++) inv[i] = inv[(int) (MOD % i)] * (MOD - MOD / i) % MOD;
  fact[0] = 1;
  for (int i = 1; i < SZ; i++) fact[i] = fact[i-1] * i % MOD;
  fact_inv[0] = 1;
  for (int i = 1; i < SZ; i++) fact_inv[i] = fact_inv[i-1] * inv[i] % MOD;

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 51060