#pragma GCC optimize("Ofast,fast-math,unroll-loops")
 
#include <bits/stdc++.h>
 
#define int ll
//#define double long double
#define endl '\n'
#define all(C) (C).begin(), (C).end()
#define rall(C) (C).rbegin(), (C).rend()
#define mp make_pair 
#define pb emplace_back
#define dbg(x) cerr << #x << " : " << x << endl
//#define PI 3.141592653589
 
using namespace std;
        
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair <int, int>;
using pld = pair <ld, ld>;

/*
const ll MAX_MEM = 4e8;
char MEM[MAX_MEM];
ll MEM_POS = 0;
void* operator new(size_t x)
{
    auto ret = MEM + MEM_POS;
    MEM_POS += x;
    assert(MEM_POS < MAX_MEM);
    return ret;
}
void operator delete(void*)
{}
*/
        
template <class T>
istream& operator>> (istream &in, vector <T> &a)
{
    for (auto &i : a)
        in >> i;
    return in;
}
        
template <class T> 
ostream& operator<< (ostream &out, vector <T> a)
{
    for (auto &i : a)
        out << i << ' ';
    return out;
}
        
template <class T, class U>
istream& operator>> (istream &in, pair <T, U> &p)
{
    in >> p.first >> p.second;
    return in;
}
        
template <class T, class U>
ostream& operator<< (ostream &out, pair <T, U> p)
{
    out << p.first << " " << p.second << " ";
    return out;
}
        
inline void Start()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    //freopen("lol.in", "r", stdin);
    //freopen("lol.out", "w", stdout);
}

const int P = 1e9 + 7;
int add(int a, int b)
{
    return a + b >= P ? a + b - P : a + b;
}
int mul(int a, int b)
{
    return (a * b) % P;
}
int bpow(int a, int n)
{
    int res = 1;
    while (n)
    {
        if (n & 1)
            res = mul(res, a);
        a = mul(a, a);
        n >>= 1;
    }
    return res;
}
int rev(int x)
{
    return bpow(x, P - 2);
}
const int N = 2e5 + 25;
vector <int> f, rf;

vector <vector <int>> g;
vector <int> sz, srt;
void predfs(int v, int p = -1)
{
    sz[v] = 1;
    srt[v] = 1;
    vector <int> son;
    for (auto &to : g[v])
    {
        if (to == p)
            continue;
        son.pb(to);
        predfs(to, v);
        sz[v] += sz[to];
    }
    for (auto &to : g[v])
    {
        if (to == p)
            continue;
        srt[v] = mul(srt[v], mul(srt[to], rf[sz[to]]));
    }
    srt[v] = mul(srt[v], f[sz[v] - 1]);
}
int n;
vector <int> dp;
void dfs(int v, int p = -1, int ns = 1, int psz = 0)
{
    int mulrf = 1;
    for (auto &to : g[v])
    {
        if (to == p)
            continue;
        mulrf = mul(mulrf, rf[sz[to]]);
    }
    mulrf = mul(mulrf, rf[psz]);
    int mulns = 1;
    for (auto &to : g[v])
    {
        if (to == p)
            continue;
        mulns = mul(mulns, srt[to]);
    }
    mulns = mul(mulns, ns);
    dp[v] = mul(mul(f[n - 1], mulrf), mulns);
    for (auto &to : g[v])
    {
        if (to == p)
            continue;
        dfs(to, v, mul(mul(f[n - sz[to] - 1], mul(mulrf, f[sz[to]])), mul(mulns, rev(srt[to]))), n - sz[to]);
    }
}

signed main()
{
    Start();
    f.assign(N, 1);
    rf.assign(N, 1);
    for (int i = 1; i < N; ++i)
        f[i] = mul(f[i - 1], i), rf[i] = mul(rf[i - 1], rev(i));
    cin >> n;
    g.resize(n);
    sz.resize(n), srt.resize(n);
    dp.resize(n);
    for (int i = 0; i < n - 1; ++i)
    {
        int u, v;
        cin >> u >> v, --u, --v;
        g[u].pb(v), g[v].pb(u);
    }
    predfs(0);
    dfs(0);
    for (auto &i : dp)
        cout << i << endl;
    return 0;
}



Measured memory_bytes: 23664