#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>

#define DIV 1000000007
using namespace std;
using ll = long long;
using ldb = long double;

vector<ll> fac;
int N;
typedef struct {
    vector<pair<int, ll>> edge;
    int par = 0;
    ll ans = 0;
    ll siz = 1;
    ll dp = 1;
    bool vi1 = 0, vi2 = 0;
}node_t;
vector<node_t> node;

long long mypow(long long k, long long n) {
    long long temp = 1;

    k = k % DIV;
    while (n) {
        if (n % 2) temp = temp * k % DIV;
        k = k * k % DIV;
        n = n / 2;
    }
    return temp % DIV;
}

ll dfs(int x) {
    int n = node[x].edge.size();
    ll nuri = 1;
    ll deno = 1;
    for (int i = 0; i < n; i++) {
        int to = node[x].edge[i].first;
        if (node[to].vi1) continue;
        node[to].vi1 = true;
        node[to].par = x;
        node[x].edge[i].second = dfs(to);
        node[x].siz += node[to].siz;
        nuri *= node[x].edge[i].second;
        nuri %= DIV;
        deno *= fac[node[to].siz];
        deno %= DIV;

    }

    ll as = nuri * (fac[node[x].siz - 1]);
    as %= DIV;
    node[x].dp = as * mypow(deno, DIV - 2);
    node[x].dp %= DIV;
    return node[x].dp;
}

void dfs2(int self, int par) {
    //cout << "self=" << self << " par=" << par << endl;
    int n = node[self].edge.size();
    if (par == -1) node[self].ans = node[self].dp%DIV;
    else {
        ll nuri = 1;
        ll deno = 1;
        for (int i = 0; i < n; i++) {
            int to = node[self].edge[i].first;
            int S = node[to].siz;
            if (to == par) {
                S = N - node[self].siz;
                ll temp = node[par].ans * mypow(fac[N - 1], DIV - 2);
                temp %= DIV;
                temp *= fac[S - 1];
                temp %= DIV;
                temp *= fac[node[self].siz];
                temp %= DIV;
                temp *= mypow(node[self].dp, DIV - 2);
                node[self].edge[i].second = temp;
            }
          	node[self].edge[i].second %=DIV;
            nuri *= node[self].edge[i].second;
            nuri %= DIV;
            deno *= fac[S];
            deno %= DIV;
        }
        ll as = nuri * fac[N - 1];
        as %= DIV;
      //if(nu<0) cout<<"self="<<self<<"  nuri="<<nuri<<endl;
      if(nuri<0) cout<<"self="<<self<<"  nuri="<<nuri<<endl;
      if(as<0) cout<<"self="<<self<<"  as="<<as<<endl;
        node[self].ans = as * mypow(deno, DIV - 2);
        node[self].ans %= DIV;
      if(node[self].ans<0) cout<<"self="<<self<<" "<<node[self].ans<<endl;
    }

    for (int i = 0; i < n; i++) {
        int to = node[self].edge[i].first;
        if (node[to].vi2) continue;
        node[to].vi2 = true;
        dfs2(to, self);
    }

}


int main() {

    cin >> N;

    node = vector<node_t>(N + 1);
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        node[a].edge.push_back(make_pair(b, 0));
        node[b].edge.push_back(make_pair(a, 0));
    }

    fac = vector<ll>(N + 1, 1);
    for (ll i = 2; i <= N; i++) {
        fac[i] = fac[i - 1] * i;
        fac[i] %= DIV;
    }


    node[1].vi1 = true;
    dfs(1);
    /*
    for (int i = 1; i <= N; i++) {
        printf("node[%d]=%lld\n", i, node[i].dp);
    }
    cout << endl;
  	*/  
  
    node[1].vi2 = true;
    dfs2(1,-1);
    for (int i = 1; i <= N; i++) {
        //printf("node[%d]=%lld\n", i, node[i].ans);
        //printf("%lld\n", node[i].ans);
      cout << node[i].ans << endl;
    }
   
}


Measured memory_bytes: 27136