#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <cstring>
using namespace std;
const long long MOD = 1000000007;
long long dp[200000];
bool used[200000];
int under[200000];
long long ans[200000];
vector <int> edges[200000];

const int MAX = 2000001;
long long fac[MAX];
long long finv[MAX];
long long inv[MAX];

void comb_init() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

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

long long power(long long m, long long n){
    long long res = 1;
    while(n > 0){
        if(n & 1) {
            res = (res * m) % MOD;
        }
        m = (m * m) % MOD;
        n >>= 1;
    }
    return res;
}

long long inverse(long long a){
    return power(a, MOD - 2);
}

void set_under(int cur){
  used[cur] = true;
  for(int i = 0; i < edges[cur].size(); i++){
    int next = edges[cur][i];
    if(!used[next]){
      set_under(next);
      under[cur] += under[next];
    }
  }
  under[cur] += 1;
}

long long calc_split(vector <long long> unders){
  if(unders.size() <= 1){
    return 1;
  }
  long long ret = 1;
  long long left_total = accumulate(unders.begin(), unders.end(), (long long) 0);
  for(int i = 0; i < unders.size() - 1; i++){
    ret = (ret * comb(left_total, unders[i])) % MOD;
    left_total -= unders[i];
  }
  return ret;
}

void dfs_initial(int cur){
  used[cur] = true;
  bool have_child = false;
  vector <long long> unders;
  for(int i = 0; i < edges[cur].size(); i++){
    int next = edges[cur][i];
    if(!used[next]){
      unders.push_back(under[next]);
    }
  }
  dp[cur] = calc_split(unders);
  for(int i = 0; i < edges[cur].size(); i++){
    int next = edges[cur][i];
    if(!used[next]){
      have_child = true;
      dfs_initial(next);
      dp[cur] = (dp[cur] * dp[next]) % MOD;
    }
  }
}

void dfs_ans(int cur, int above, long long above_dp, int N){
  //cout << cur << " " << above << " " << above_dp << endl;
  used[cur] = true;
  vector <long long> cur_under;
  if(above != 0){
    cur_under.push_back(above);
  }
  for(int i = 0; i < edges[cur].size(); i++){
    int next = edges[cur][i];
    if(!used[next]){
      cur_under.push_back(under[next]);
    }
  }
  long long whole_split = calc_split(cur_under);
  long long dp_prod = above_dp;
  //ans[cur] = whole_split;
  //ans[cur] = (ans[cur] * above) % MOD;
  for(int i = 0; i < edges[cur].size(); i++){
    int next = edges[cur][i];
    if(!used[next]){
      dp_prod = (dp_prod * dp[next]) % MOD;
    }
  }
  //cout << whole_split << " " << dp_prod << endl;
  ans[cur] = (whole_split * dp_prod) % MOD;

  for(int i = 0; i < edges[cur].size(); i++){
    int next = edges[cur][i];
    if(!used[next]){
      long long split = (whole_split * inverse(comb(N - 1, under[next]))) % MOD;
      long long cur_dp_prod = (dp_prod * inverse(dp[next])) % MOD;
      dfs_ans(next, N - under[next], (split * cur_dp_prod) % MOD, N);
    }
  }
}

int main(){
  int N;
  cin >> N;
  for(int i = 0; i < N - 1; i++){
    int a;
    int b;
    cin >> a >> b;
    edges[a - 1].push_back(b - 1);
    edges[b - 1].push_back(a - 1);
  }

  comb_init();
  set_under(0);
  for(int i = 0; i < N; i++){
    used[i] = false;
  }
  dfs_initial(0);
  for(int i = 0; i < N; i++){
    used[i] = false;
  }
  dfs_ans(0, 0, 1, N);

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

  return 0;
}


Measured memory_bytes: 66944