#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
    long long x;
    mint(long long 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 { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(long long t) const {
        if (!t) 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 { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1), ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

// combination c(max);
// mint c(n, k)
combination c(200000);

struct Rerooting {
    struct DP {
        int size;
        mint dp;
        DP(int size=0, mint dp=1) : size(size), dp(dp) {}
        DP operator+(const DP& a) const {
            // edit here
            // ex) return DP(size + a.size);
            // dp *= a.dp;
            // dp *= c(size + a.size, size);
            // size += a.size;
            return DP(size + a.size, dp * a.dp * c(size + a.size, size));
        }
        DP addRoot() const {
            return DP(size + 1, dp);
        }
    };
    int n;
    vector<vector<int>> to;
    vector<vector<DP>> dp;
    vector<DP> ans;
    Rerooting(int n=0) : n(n), to(n), dp(n), ans(n) {}
    void addEdge(int a, int b) {
        to[a].push_back(b);
        to[b].push_back(a);
    }
    void init() {
        dfs(0);
        bfs(0);
    }
    DP dfs(int v, int p=-1) {
        DP dpSum;
        int deg = to[v].size();
        dp[v] = vector<DP>(deg);
        for (int i = 0; i < deg; ++i) {
            int nv = to[v][i];
            if (nv == p) continue;
            dp[v][i] = dfs(nv, v);
            dpSum = dpSum + dp[v][i];
        }
        return dpSum.addRoot();
    }
    void bfs(int v, const DP& dpP=DP(), int p=-1) {
        int deg = to[v].size();
        for (int i = 0; i < deg; ++i) if (to[v][i] == p) dp[v][i] = dpP;
        vector<DP> dpSumL(deg+1);
        for (int i = 0; i < deg; ++i) dpSumL[i+1] = dpSumL[i] + dp[v][i];
        vector<DP> dpSumR(deg+1);
        for (int i = deg-1; i >= 0; --i) dpSumR[i] = dpSumR[i+1] + dp[v][i];
        ans[v] = dpSumL[deg].addRoot();

        for (int i = 0; i < deg; ++i) {
            int nv = to[v][i];
            if (nv == p) continue;
            DP d = dpSumL[i] + dpSumR[i+1];
            bfs(nv, d.addRoot(), v);
        }
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    Rerooting rt(n);
    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        rt.addEdge(a, b);
    }
    rt.init();
    rep(i, n) cout << rt.ans[i].dp << endl;
}

Measured memory_bytes: 38644