#include<vector>
#include<functional>
#include<iostream>
#include<string>

template <typename T>
struct ReRooting{
private:
    using F = std::function<T(T, int)>;
    using F2 = std::function<T(T, T)>;
    int n;
    std::vector<std::vector<int>> G;
    std::vector<std::vector<T>> dp;
    F f, g;
    F2 merge;
    T ide;

    T dfs1(int p, int k){
        T res = ide;
        int cnt = -1;
        for(int i = 0; i < G[k].size(); i++){
            if(G[k][i] == p) continue;
            dp[k][i] = dfs1(k, G[k][i]);
            res = merge(res, f(dp[k][i], G[k][i]));
        }
        return g(res, k);
    }

    void dfs2(int p, int k, T add){
        for(int i = 0; i < G[k].size(); i++){
            if(G[k][i] == p){
                dp[k][i] = add;
                break;
            }
        }
        std::vector<T> pL(G[k].size() + 1), pR(G[k].size() + 1);

        pL[0] = ide;
        for(int i = 0; i < G[k].size(); i++)
            pL[i + 1] = merge(pL[i], f(dp[k][i], G[k][i]));

        pR[G[k].size()] = ide;
        for(int i = G[k].size() - 1; i >= 0; i--)
            pR[i] = merge(pR[i + 1], f(dp[k][i], G[k][i]));

        for(int i = 0; i < G[k].size(); i++){
            if(G[k][i] == p) continue;
            T val = merge(pL[i], pR[i + 1]);
            dfs2(k, G[k][i], g(val, k));
        }
    }

    void build(int root){
        for(int i = 0; i < n; i++) 
            dp[i].resize(G[i].size());
        dfs1(-1, root);
        dfs2(-1, root, ide);
    }

public:
    ReRooting(std::vector<std::vector<int>> G_, F f_, F2 merge_, T ide_, F g_ = [](T a, int b){return a;})
    : G(G_), f(f_), merge(merge_), ide(ide_), g(g_), n(G_.size()), dp(G_.size()) {}

    std::vector<T> solve(int root = 0){
        build(root);
        std::vector<T> vec(n);
        for(int k = 0; k < n; k++){
            T res = ide;
            for(int i = 0; i < G[k].size(); i++) res = merge(res, f(dp[k][i], G[k][i]));
            vec[k] = g(res, k);
        }
        return vec;
    }
};

//ModInt
template <const int &mod>
struct ModInt {
private:
    long long x;

    long long ext_gcd(long long a, long long b, long long &x, long long &y){
        if(b == 0){
            x = 1, y = 0;
            return a;
        }
        long long q = a / b;
        long long g = ext_gcd(b, a - q * b, x, y);
        long long z = x - q * y;
        x = y, y = z;
        return g;
    }

public:    
    ModInt() : x(0) {}

    ModInt(long long x_) {
        if ((x = x_ % mod + mod) >= mod) x -= mod;
    }

    constexpr ModInt& operator+=(ModInt rhs){
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }

    constexpr ModInt& operator-=(ModInt rhs){
        if ((x -= rhs.x) < 0) x += mod;
        return *this;
    }

    constexpr ModInt& operator*=(ModInt rhs){
        x = (unsigned long long)x * rhs.x % mod;
        return *this;
    }

    constexpr ModInt& operator/=(ModInt rhs){
        x = (unsigned long long)x * rhs.inv().x % mod;
        return *this;
    }
  
    constexpr ModInt operator-() const noexcept{ return -x < 0 ? mod - x : -x; }

    constexpr ModInt operator+(ModInt rhs) const noexcept{ return ModInt(*this) += rhs; }

    constexpr ModInt operator-(ModInt rhs) const noexcept{ return ModInt(*this) -= rhs; }

    constexpr ModInt operator*(ModInt rhs) const noexcept{ return ModInt(*this) *= rhs; }

    constexpr ModInt operator/(ModInt rhs) const noexcept{ return ModInt(*this) /= rhs; }

    constexpr ModInt &operator++ () { *this += 1; return *this;}

    constexpr ModInt operator++ (int) { *this += 1; return *this - 1;}

    constexpr ModInt &operator-- () { *this -= 1; return *this;}

    constexpr ModInt operator-- (int) { *this -= 1; return *this + 1;}

    bool operator==(ModInt rhs) const { return x == rhs.x; }    

    bool operator!=(ModInt rhs) const { return x != rhs.x; }

    bool operator<=(ModInt rhs) const { return x <= rhs.x; }

    bool operator>=(ModInt rhs) const { return x >= rhs.x; }

    bool operator<(ModInt rhs) const { return x < rhs.x; }

    bool operator>(ModInt rhs) const { return x > rhs.x; }

    ModInt inv() {
        long long x, y;
        ext_gcd(this->x, mod, x, y);
        return (ModInt) x;
    }
  
    friend std::ostream& operator<<(std::ostream& s, ModInt<mod> a) {
        s << a.x;
        return s;
    }
    
    friend std::istream& operator>>(std::istream& s, ModInt<mod>& a) {
        s >> a.x;
        return s;
    }
};

//Modulo Calculation
static int MOD = 1e9 + 7;
// static int MOD = 998244353;
using mint = ModInt<MOD>;

const int CombMAX = 1000000;
mint fac[CombMAX + 1],finv[CombMAX + 1],inv[CombMAX + 1];

struct Combinationinit{
    Combinationinit(){
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for(int i = 2; i <= CombMAX; i++){
            fac[i] = fac[i - 1] * (mint)i; 
            inv[i] = (mint)MOD - inv[MOD % i] * (MOD / i);
            finv[i] = finv[i - 1] * inv[i];
        }
    }
}Combinationinit_;

//nCk
mint COM(int n,int k){
    if(n < k or n < 0 or k < 0)return 0;
    return fac[n]* finv[k]* finv[n - k];
}

//nPk
mint PER(int n, int k){
    if(n < k or n < 0 or k < 0) return 0;
    return fac[n] / fac[n - k];
}

//nHk
mint HOM(int n, int k) {return COM(n + k - 1, k);};

int main(){
    int n;
    std::cin >> n;
    std::vector<std::vector<int>> G(n);
    for(int i = 0; i < n - 1; i++){
        int a, b;
        std::cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    using P = std::pair<mint, int>;
    auto f = [&](P p, int v){return P(p.first * finv[p.second], p.second);};
	auto merge = [&](P p, P q){return P(p.first * q.first, p.second + q.second);};
	auto g = [&](P p, int v){return P(p.first * fac[p.second], p.second + 1);};
	ReRooting<P> ReRoot(G, f, merge, P{1, 0}, g);
	auto res = ReRoot.solve();
	for(int i = 0; i < n; i++)
        std::cout << res[i].first << '\n';
}

Measured memory_bytes: 70296