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

template<int64_t MOD> class ModInt {
public:
    int64_t x;
    constexpr ModInt() : x(0) {}
    constexpr ModInt(int64_t v) : x((v % MOD + MOD) % MOD) {}
    constexpr ModInt operator - () const noexcept { return x ? MOD - x : 0;}
    constexpr ModInt operator + (const ModInt a) const noexcept { return ModInt(*this) += a;}
    constexpr ModInt operator - (const ModInt a) const noexcept { return ModInt(*this) -= a;}
    constexpr ModInt operator * (const ModInt a) const noexcept { return ModInt(*this) *= a;}
    constexpr ModInt operator / (const ModInt a) const noexcept { return ModInt(*this) /= a;}
    constexpr ModInt operator / (const int64_t a) const noexcept { return ModInt(*this) /= a;}
    constexpr ModInt operator += (const ModInt a) noexcept {
        x += a.x;
        if (x >= MOD) x -= MOD;
        return *this;
    }
    constexpr ModInt operator += (const int64_t a) noexcept {
        auto hs = ModInt<MOD>(a);
        (*this) += hs;
        return *this;
    }
    constexpr ModInt operator -= (const ModInt a) noexcept {
        if (x < a.x) x += MOD;
        x -= a.x;
        return *this;
    }
    constexpr ModInt operator -= (const int64_t a) noexcept {
        auto hs = ModInt<MOD>(a);
        (*this) -= hs;
        return *this;
    }
    constexpr ModInt operator *= (const ModInt a) noexcept {
        x = x * a.x % MOD;
        return *this;
    }
    constexpr ModInt operator *= (const int64_t a) noexcept {
        auto hs = ModInt<MOD>(a);
        (*this) *= hs;
        return *this;
    }
    constexpr ModInt &operator /= (ModInt a) noexcept {
        int64_t exp = MOD - 2;
        while (exp > 0) {
            if (exp & 1ul) *this *= a;
            a *= a;
            exp >>= 1ul;
        }
        return *this;
    }
    constexpr ModInt &operator /= (int64_t a) noexcept {
        auto hs = ModInt<MOD>(a);
        (*this) /= hs;
        return *this;
    }
    constexpr ModInt &operator ++ () noexcept {
        if (++x >= MOD) x -= MOD;
        return *this;
    }
    constexpr ModInt &operator -- () noexcept {
        if (x-- == 0) x += MOD;
        return *this;
    }
    constexpr bool operator < (const ModInt a) const noexcept { return x < a.x;}
    constexpr bool operator == (const ModInt a) const noexcept { return this->x == a.x;}
    constexpr bool operator != (const ModInt a) const noexcept { return !(*this == a);}
    friend istream &operator >> (istream &in, ModInt &m) {
        in >> m.x;
        if (m.x < 0) m.x += MOD;
        m.x %= MOD;
        return in;
    }
    friend ostream &operator << (ostream &out, const ModInt &p) { return out << p.x;}
    constexpr ModInt pow(int64_t p) const {
        ModInt ret(1);
        ModInt mul(x);
        while (p > 0) {
            if (p & 1ul) ret *= mul;
            mul *= mul;
            p >>= 1ul;
        }
        return ret;
    }
};

const int64_t MOD = 1000000007LL;
using mint = ModInt<MOD>;

class Combination {
public:
    vector<mint> fac, finv, inv;
    Combination(int n) : fac(n, 1), finv(n, 1), inv(n, 1) {
        for(int i = 2; i < n; i++) {
            fac[i] = fac[i - 1] * i;
            inv[i] = -inv[MOD % i] * (MOD / i);
            finv[i] = finv[i - 1] * inv[i];
        }
    }
    mint operator()(int n, int k) {
        if(n < k ||n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k]);
    }
} nCk(200200);

struct Data {
    int size;
    mint val;
    Data() { size = 0, val = 1; }
    Data addRoot() {
        Data res(*this);
        res.size++;
        return res;
    }
};

Data merge(Data a, Data b) {
    Data res(a);
    res.val *= b.val;
    res.val *= nCk(res.size + b.size, res.size);
    res.size += b.size;
    return res;
}

Data rev(Data a, Data b) {
    Data res(a);
    res.size -= b.size;
    res.val /= nCk(res.size + b.size, res.size);
    res.val /= b.val;
    return res;
}

int main() {
    int N; cin >> N;
    vector<vector<int>> G(N);
    for(int i = 0; i < N - 1; ++i) {
        int a, b; cin >> a >> b;
        a--, b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }

    vector<Data> dp(N);
    auto dfs = [&](auto &&dfs, int cur, int pre) -> void {
        for(auto &to : G[cur]) {
            if(to == pre) continue;
            dfs(dfs, to, cur);
            dp[cur] = merge(dp[cur], dp[to].addRoot());
        }
    };

    auto efs = [&](auto &&efs, int cur, int pre) -> void {
        for(auto &to : G[cur]) {
            if(to == pre) continue;
            Data d = rev(dp[cur], dp[to].addRoot());
            dp[to] = merge(dp[to], d.addRoot());
            efs(efs, to, cur);
        }
    };

    dfs(dfs, 0, 0);
    efs(efs, 0, 0);
    for(int i = 0; i < N; ++i) cout << dp[i].val << '\n';
    return 0;
}


Measured memory_bytes: 21748