#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X,i) ((X>>i)&1)
#define rng(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define ina(x,n) rep(x_i,n) cin>>x[x_i]
#define outa(x,n) rep(x_i,n) cerr<<x[x_i]<<" \n"[x_i==n-1]
#define DEBUG(x) cerr<<__LINE__<<": "<<#x<<" = "<<x<<"\n"

using ll  = long long int;
using vl  = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;
using vll = vector<pll>;

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

const int inf = (1<<28);
const ll infl = (1LL<<60);
const int mod = 1e9+7;
struct mint {
    ll x;
    mint(ll x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (t == 0) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};
const int MAX_N = 1e6;
int n;
vvl edges;
vl size;
vector<mint> factorial(MAX_N);
vector<mint> dp;
vector<mint> ans;

int dfs(int root, int parent) {
    int sum = 1;
    mint dpr(1);
    for (auto ch : edges[root]) {
        if (ch == parent) continue;
        size[ch] = dfs(ch, root);
        sum += size[ch];
        dpr *= dp[ch] / factorial[size[ch]];
    }
    size[root] = sum;
    dp[root] = factorial[sum-1] * dpr;
    return sum;
}

void calc(int root, int parent) {
    mint aux = ans[parent] / factorial[n-1];
    aux /= (dp[root] / factorial[size[root]]);
    aux *= factorial[n-size[root]-1];
    ans[root] = dp[root];
    ans[root] /= factorial[size[root]-1];
    ans[root] *= aux / factorial[n-size[root]];
    ans[root] *= factorial[n-1];
    for (auto ch : edges[root]) {
        if (ch == parent) continue;
        calc(ch, root);
    }
}

int main() {
    cin >> n;
    edges.resize(n);
    dp.resize(n);
    ans.resize(n);
    size.resize(n);
    rep(i,n-1) {
        int a, b; cin >> a >> b;
        a--; b--;
        edges[a].pb(b);
        edges[b].pb(a);
    }
    factorial[0] = mint(1);
    rng(i,1,MAX_N) {
        factorial[i] = mint(i) * factorial[i-1];
    }
    dfs(0, -1);

    ans[0] = dp[0];
    for (auto ch : edges[0]) {
        if (ch == 0) continue;
        calc(ch, 0);
    }
    rep(i,n) {
        cout << ans[i].x << endl;
    }
    return 0;
}


Measured memory_bytes: 27248