#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdint>
#include <queue>

int const MAXN = 2e5;
int64_t const MOD = 1e9+7;

std::vector<int> G[MAXN];
int N;

int64_t inv[MAXN+1];
int64_t fact[MAXN+1];
int64_t ifact[MAXN+1];

void init(int n) {
  fact[0] = ifact[0] = fact[1] = ifact[1] = inv[1] = 1;
  for(int64_t i = 2; i <= n; ++i) {
    fact[i] = fact[i-1]*i%MOD;
    inv[i] = (MOD/i)*(MOD - inv[MOD%i])%MOD;
    ifact[i] = ifact[i-1]*inv[i]%MOD;
  }
}

int64_t nn[MAXN];
int64_t dp1[MAXN];

void dfs1(int v, int p) {
  int64_t num = 0, val = 1;
  for(auto e: G[v]) {
    if(e == p) continue;
    dfs1(e, v);
    num += nn[e];
    val = val*dp1[e]%MOD;
    val = val*ifact[nn[e]]%MOD;
  }
  dp1[v] = val*fact[num]%MOD;
  nn[v] = num + 1;
}

void dfs2(int v, int p) {
  for(auto e: G[v]) {
    if(e == p) continue;
    int64_t tmp = dp1[v]*nn[e]%MOD;
    dp1[e] = tmp*inv[N-nn[e]]%MOD;
    dfs2(e, v);
  }
}

int main() {
  std::cin >> N;
  init(std::max(2, N));
  for(int i = 0; i < N-1; ++i) {
    int a, b;
    std::cin >> a >> b; --a; --b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  dfs1(0, -1);
  dfs2(0, -1);
  for(int i = 0; i < N; ++i) std::cout << dp1[i] << std::endl;
  return 0;
}
