#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

template <uint MD> struct ModInt {
    using M = ModInt;
    const static M G;
    uint v;
    ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<1000000007>;

Mint frac[200010];
Mint invfrac[200010];

void fracinvfrac(ll n) {
    frac[0] = 1;
    for (int i = 1; i <= n; i++) {
        frac[i] = frac[i - 1] * i;
    }
    invfrac[n] = (Mint)1 / frac[n];
    for (int i = n - 1; i >= 0; i--) {
        invfrac[i] = invfrac[i + 1] * (i + 1);
    }
}

Mint modcombi(ll x, ll y) {
    if (x < y || y < 0) {
        return 0;
    } else if (y == 0) {
        return 1;
    } else {
        return frac[x] * invfrac[x - y] * invfrac[y];
    }
}

struct edge {
    ll to, cost;
};

int N;
// vector<edge> G[1000000];
VV<edge> G(1000000);
V<ll> d(1000000);

void addedge(VV<edge>& G, int st, int ed, ll co) {
    edge e;
    e.to = ed;
    e.cost = co;
    G[st].push_back(e);
}

//根付き木を作る。parentVectorに親nodeの番号が入る。
//parentVector[root] = -1
//treeRankVectorにはnodeのrankが入る。rootのrankは0
vector<ll> par;
vector<ll> treeRank;
void makeRootedTree(vector<ll> &parentVector, vector<ll> &treeRankVector, ll vecSize, ll root) {
    parentVector = vector<ll>(vecSize);
    treeRankVector = vector<ll>(vecSize);
    assert(root < (ll)parentVector.size());
    parentVector[root] = -1;
    treeRankVector[root] = 0;
    queue<ll> que;
    que.push(root);
    while (!que.empty()) {
        ll node = que.front();
        que.pop();
        REP (i, 0, G[node].size()) {
            edge e = G[node][i];
            if (e.to != parentVector[node]) {
                parentVector[e.to] = node;
                treeRankVector[e.to] = treeRankVector[node] + 1;
                que.push(e.to);
            }
        }
    }
}

V<Mint> dp(1000000, 1);
V<ll> treeSize(1000000, 0);
V<Mint> dpsub(1000000, 1);
//根付き木の葉から根に向かって何か処理をする
//根付き森でもOK。根のparentは-1にしておく
void leafToRoot(vector<ll> &parentVector) {
    queue<ll> que;
    vector<ll> used(parentVector.size());
    fill(used.begin(), used.end(), 0);
    REP(i, 0, parentVector.size()) {
        if (parentVector[i] != -1 && G[i].size() == 1) {
            que.push(i);
            used[i] = 1;
        }
    }
    while (!que.empty()) {
        ll node = que.front();
        que.pop();

        //rootも含めて子だけのときに何かやりたいときはここに書く
        ll sz = treeSize[node];
        dp[node] = dpsub[node];
        // cout << node << " " << dp[node] << " " << sz << endl;
        REP(i, 0, G[node].size()) {
            edge e = G[node][i];
            if (e.to != parentVector[node]) {
                dp[node] *= modcombi(sz, treeSize[e.to] + 1);
                sz -= treeSize[e.to] + 1;
            }
        }

        if (parentVector[node] == -1) {
            continue;
        }
        ll parent = parentVector[node];
        used[parent]++;

        //ここに書く
        treeSize[parent] += treeSize[node] + 1;
        dpsub[parent] *= dp[node];

        if ((parentVector[parent] == -1 && used[parent] == (ll)G[parent].size()) ||
            (parentVector[parent] != -1 && used[parent] == (ll)G[parent].size() - 1)) {
            que.push(parent);
        }
    }
}

V<Mint> ans(1000000);
void dfs() {
    queue<ll> que;
    que.push(0);
    while(!que.empty()) {
        ll node = que.front();
        que.pop();
        ans[node] = dp[node];
        ll parent = par[node];
        Mint parnum = 1;
        if (parent != -1) {
            parnum = ans[parent];
            parnum /= modcombi(N - 1, treeSize[node] + 1);
            parnum /= dp[node];
        }
        // cout << node << " " << parnum << endl;
        Mint tmp = 1;
        REP(i, 0, G[node].size()) {
            edge e = G[node][i];
            if (e.to != parent) {
                que.push(e.to);
                tmp *= dp[e.to];
            } else {
                tmp *= parnum;
            }
        }
        // cout << node << " " << tmp << endl;
        ll sz = N - 1;
        REP(i, 0, G[node].size()) {
            edge e = G[node][i];
            ll subsz = 0;
            if (e.to != parent) {
                subsz = treeSize[e.to] + 1;
            } else {
                subsz = N - (treeSize[node] + 1);
            }
            tmp *= modcombi(sz, subsz);
            sz -= subsz;
        }
        // cout << node << " " << tmp << endl;
        ans[node] = tmp;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    fracinvfrac(200005);
    // cout << "aaa" << endl;
    // cout << N << endl;
    REP(i, 0, N - 1) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        addedge(G, a, b, 0);
        addedge(G, b, a, 0);
        // cout << "ccc" << endl;
    }
    // cout << "bbb" << endl;
    makeRootedTree(par, treeRank, N, 0);
    leafToRoot(par);
    // REP(i, 0, N) {
    //     cout << i << " " << dpsub[i] << " " << dp[i] << endl;
    // }
    // cout << "ddd" << endl;
    dfs();
    REP(i, 0, N) {
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 70252