#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define EPS 1e-8
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f3f3f3f3f
#define MEM(a, b) memset(a, b, sizeof(a))
#define PPER(i, n, m) for (int i = n; i >= m; i--)
#define REPP(i, n, m) for (int i = n; i <= m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define PER(i, n, m) for (int i = n; i > m; i--)
#define SA(n) scanf("%d", &(n))
#define SLLA(n) scanf("%lld", &(n))
#define MP make_pair
#define FF first
#define SS second
#define PB push_back
#define DE(val) cout << #val << ": " << val << endl;
 
const int dx44[6] = {0, -1, -1, 1, 1};
const int dy44[6] = {0, -1, 1, -1, 1};
const int dx4[6] = {0, 0, 1,-1};
const int dy4[6] = {1, -1, 0,0};
const int dx8[9] = {0, -1, 0, 1, 0, 1, 1, -1, -1};
const int dy8[9] = {0, 0, 1, 0, -1, 1, -1, 1, -1};
const int dx82[9] = {0, -1, -1, 1, 1, 2, 2, -2, -2};
const int dy82[9] = {0, 2, -2, 2, -2, 1, -1, 1, -1};

void update(ll& x,ll v){
    if(x==-1)x=v;
    else if(x>v)x=v;
}
 
ll po(ll a, ll b, ll mod)
{
    ll res = 1;
    a %= mod;
    for (; b; b >>= 1)
    {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}
ll gcd(ll a, ll b)
{
    if (a == 0)
    {
        return b;
    }
    else
    {
        return gcd(b % a, a);
    }
}
void extgcd(ll a, ll b, ll &d, ll &x, ll &y)
{
    if (!b)
    {
        d = a;
        x = 1;
    }
    else
    {
        extgcd(b, a % b, d, y, x);
        y -= x * (a / b);
    }
}
ll inverse(ll a, ll n)
{
    ll d, x, y;
    extgcd(a, n, d, x, y);
    return d == 1 ? (x + n) % n : -1;
}
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const int maxn = 2e5 + 15;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
/*************************************************************************/

int n;
std::vector<int> edge[maxn];
ll fac[maxn], inv_fac[maxn];
ll res[maxn];
ll sz[maxn], mul[maxn];

void dfs(int root, int fa) {
    sz[root] = 1;
    mul[root] = 1;
    REP(i,0,edge[root].size()) {
        int nxt = edge[root][i];
        if(nxt == fa) {
            continue;
        }
        dfs(nxt, root);
        sz[root] += sz[nxt];
        mul[root] = mul[root] * mul[nxt] % mod;
    }
    mul[root] = mul[root] * sz[root] % mod;
}

void dfs2(int root, int fa, ll premul) {
    ll k = premul;

    REP(i,0,edge[root].size()) {
        int nxt = edge[root][i];
        if(nxt == fa) {
            continue;
        }
        k = k * mul[nxt] % mod;
    }
    res[root] = fac[n - 1] * po(k, mod-2,mod) % mod;
    REP(i,0,edge[root].size()) {
        int nxt = edge[root][i];
        if(nxt == fa) {
            continue;
        }
        dfs2(nxt, root, k * po(mul[nxt], mod -2, mod) % mod * (n - sz[nxt])%mod);
    }
}

void solve() {
    SA(n);
    REPP(i,1,n-1) {
        int a, b;
        SA(a);
        SA(b);
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    fac[0] = 1;
    inv_fac[0] = 1;
    REPP(i,1,n) {
        fac[i] = fac[i-1] * i % mod;
        inv_fac[i] = po(fac[i], mod - 2, mod);
    }
    dfs(1, -1);
    dfs2(1, -1, 1);
    REPP(i,1,n) {
        printf("%lld\n", res[i]);
    }
}


int main()
{   
#ifndef ONLINE_JUDGE
    // freopen("i.txt", "r", stdin);
    // freopen("o.txt", "w", stdout);
#endif
    solve();
    // int t;
    // SA(t);
    // REPP(i,1,t) {
    //     printf("Case #%d: ", i);
    //     solve();
    // }
    return 0;
 
}
 

Measured memory_bytes: 21748