// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const long long MOD = 1000000007;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


template <i64 mod = MOD>
struct ModInt{
    i64 p;

    ModInt() : p(0){}
    ModInt(i64 x){p = x >= 0 ? x % mod : x + (-x + mod - 1) / mod * mod;}

    ModInt& operator+=(const ModInt& y){p = p + *y - ((p + *y) >= mod ? mod : 0); return *this;}
    ModInt& operator-=(const ModInt& y){p = p - *y + (p - *y < 0 ? mod : 0); return *this;}
    ModInt& operator*=(const ModInt& y){p = (p * *y) % mod; return *this;}
    ModInt& operator%=(const ModInt& y){if(y)p %= *y; return *this;}

    ModInt operator+(const ModInt& y) const{ModInt x = *this; return x += y;}
    ModInt operator-(const ModInt& y) const{ModInt x = *this; return x -= y;}
    ModInt operator*(const ModInt& y) const{ModInt x = *this; return x *= y;}
    ModInt operator%(const ModInt& y) const{ModInt x = *this; return x %= y;}

    friend ostream& operator<<(ostream& stream, const ModInt<mod>& x){
        stream << *x;
        return stream;
    }

    friend ostream& operator>>(ostream& stream, const ModInt<mod>& x){
        stream >> *x;
        return stream;
    }

    ModInt& operator++(){p = (p + 1) % mod; return *this;}
    ModInt& operator--(){p = (p - 1 + mod) % mod; return *this;}

    bool operator==(const ModInt& y) const{return p == *y;}
    bool operator!=(const ModInt& y) const{return p != *y;}

    const i64& operator*() const{return p;}
    i64& operator*(){return p;}

};

using mint = ModInt<>;

struct BinaryLifting{
    int n;
    vector<vector<int>> next;
    vector<int> par;
    vector<vector<int>> childs;
    vector<int> depth;

    BinaryLifting(vector<vector<int>>& edges, int root = 0) : n(edges.size()), depth(n, -1), par(n, -1), childs(n){
        function<void(int)> dfs = [&](int x){
            for(auto y : edges[x])
                if(depth[y] == -1){
                    depth[y] = depth[x] + 1;
                    par[y] = x;
                    childs[x].push_back(y);
                    dfs(y);
                }
        };
        depth[root] = 0;
        dfs(root);

        next.push_back(par);
        for(int k = 0;; ++k){
            bool fl = false;
            next.emplace_back(n, -1);
            for(int i = 0; i < n; ++i){
                next[k + 1][i] = (next[k][i] == -1 ? -1 : next[k][next[k][i]]);
                if(next[k + 1][i] != -1)
                    fl = true;
            }
            if(!fl)
                break;
        }
    }
    // kth_next(x, 0) => x
    int kth_next(int x, int k){
        for(int i = 0; i < next.size() && k; ++i){
            if(k & (1 << i)){
                x = next[i][x];
                if(x == -1)
                    break;
            }
        }
        return x;
    }

    int lca(int x, int y){
        int min_depth = min(depth[x], depth[y]);
        x = kth_next(x, depth[x] - min_depth);
        y = kth_next(y, depth[y] - min_depth);
        if(x == y)
            return x;
        for(int i = next.size() - 1; i >= 0; --i)
            if(next[i][x] != next[i][y]){
                x = next[i][x];
                y = next[i][y];
            }
        return next[0][x];
    }
};


void solve(long long n, std::vector<long long> a, std::vector<long long> b){
    vector<vector<int>> edges(n);
    for(int i = 0; i < n - 1; ++i){
        --a[i], --b[i];
        edges[a[i]].push_back(b[i]);
        edges[b[i]].push_back(a[i]);
    }
    auto mpow = [](auto x, i64 y){
     auto z = x;
     decltype(x) val = y & 1 ? x : decltype(x)(1);
     while(z *= z, y >>= 1)
      if(y & 1)
       val *= z;
     return val;
    };

    auto calc_fact = [mpow]{
     constexpr int N = 2e5;
     vector<mint> fact(N + 1, 1);
     vector<mint> inv(N + 1, 1);
     for(int i = 1; i < N; ++i){
      fact[i + 1] = fact[i] * (i + 1);
      inv[i + 1] = mpow(fact[i + 1], MOD - 2);
     }
     return make_pair(fact, inv);
    };
    vector<mint> fact, inv;
    tie(fact, inv) = calc_fact();

    auto ncr = [&fact, &inv](int n, int r){
     if(n < 0 || r < 0 || n < r)
      return mint(0);
     return fact[n] * inv[r] * inv[n - r];
    };

    auto childs = BinaryLifting(edges).childs;
    vector<int> siz(n, 0);
    vector<mint> pat(n, 0);
    vector<mint> pat2(n, 0);
    function<void(int)> f = [&](int x){
        pat[x] = 1;
        for(auto& y : childs[x]){
            f(y);
            pat[x] *= pat[y];
            pat[x] *= ncr(siz[x] + siz[y], siz[y]);
            siz[x] += siz[y];
        }
        ++siz[x];
    };
    f(0);

    pat2[0] = pat[0];

    function<void(int, mint)> g = [&](int x, mint par_pat){
        pat2[x] = pat[x] * par_pat * ncr(n - 1, siz[x] - 1);
        for(auto y : childs[x]){
            mint div = pat[y] * ncr(n - 1, siz[y]);
            mint p_pat = pat2[x] * mpow(div, MOD - 2);
            g(y, p_pat);
        }
    };
    g(0, 1);
    for(int i = 0; i < n; ++i)
        cout << pat2[i] << endl;
}

signed main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N-1);
    std::vector<long long> b(N-1);
    for(int i = 0 ; i < N-1 ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
    }
    solve(N, std::move(a), std::move(b));
    return 0;
}


Measured memory_bytes: 37192