#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
using namespace std;
using ll = long long;
template<typename T>
inline bool chmax(T& a, const T& b) {
    if (a < b){
        a = b;
        return true;
    }
    return false;
}
template<typename T>
inline bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> vector<T> make_vec(size_t n) { return vector<T>(n); }
template<typename T, typename... Args> auto make_vec(size_t n, Args... args) {
    return vector<decltype(make_vec<T>(args...))>(n, make_vec<T>(args...));
}
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value>::type fill_v(U& u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<!is_same<T, U>::value>::type fill_v(U& u, const V... v) {
    for (auto& e : u) fill_v<T>(e, v...);
}

template<uint_fast64_t Modulus>
struct modint {
    using u64 = uint_fast64_t;
    u64 a;
    constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
    constexpr u64& value() noexcept { return a; }
    constexpr const u64& value() const noexcept { return a; }
    constexpr modint operator+(const modint rhs) const noexcept {
        return modint(*this) += rhs;
    }
    constexpr modint operator-(const modint rhs) const noexcept {
        return modint(*this) -= rhs;
    }
    constexpr modint operator*(const modint rhs) const noexcept {
        return modint(*this) *= rhs;
    }
    constexpr modint operator/(const modint rhs) const noexcept {
        return modint(*this) /= rhs;
    }
    constexpr modint& operator+=(const modint rhs) noexcept {
        a += rhs.a;
        if (a >= Modulus) a -= Modulus;
        return *this;
    }
    constexpr modint& operator-=(const modint rhs) noexcept {
        if (a < rhs.a) a += Modulus;
        a -= rhs.a;
        return *this;
    }
    constexpr modint& operator*=(const modint rhs) noexcept {
        a = a * rhs.a % Modulus;
        return *this;
    }
    constexpr modint& operator/=(modint rhs) noexcept {
        return *this *= rhs.inv();
    }
    constexpr modint& operator++() noexcept {
        a++;
        if (a == Modulus) a = 0;
        return *this;
    }
    constexpr modint operator++(int) noexcept {
        modint tmp(*this);
        operator++();
        return tmp;
    }
    constexpr modint& operator--() noexcept {
        if (a == 0) a = Modulus;
        a--;
        return *this;
    }
    constexpr modint operator--(int) noexcept {
        modint tmp(*this);
        operator--();
        return tmp;
    }
    constexpr modint pow(u64 exp) const noexcept {
        modint res(1), mul(*this);
        for (; exp; mul *= mul, exp >>= 1) if (exp & 1) res *= mul;
        return res;
    }
    constexpr modint inv() const noexcept {
        return modint(*this).pow(Modulus - 2);
    }
    constexpr bool operator==(modint rhs) const noexcept { return a == rhs.a; }
    constexpr bool operator!=(modint rhs) const noexcept { return a != rhs.a; }
    friend ostream& operator<<(ostream& os, const modint<Modulus>& rhs) { return os << rhs.a; }
};

using mint = modint<1000000007>;

vector<mint> fact, ifact;
void init(int n) {
    fact.resize(n+1);
    ifact.resize(n+1);
    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 comb(int n, int k) { return fact[n] * ifact[k] * ifact[n-k]; }
mint perm(int n, int k) { return fact[n] * ifact[n-k]; }

template<typename T>
struct rerooting {
    using F1 = function<T(T, int)>;
    using F2 = function<T(T, T)>;

    int n;
    F1 f, g; // f : pre-merge, g : post-merge
    F2 merge;
    T id;
    vector<vector<int>> graph;
    vector<vector<T>> dp;

    rerooting(int n, F1 f, F1 g, F2 merge, T id)
        : n(n), f(f), g(g), merge(merge), id(id), graph(n), dp(n) {}

    void add_edge(int u, int v) {
        graph[u].push_back(v);
        graph[v].push_back(u);
    }

    T dfs1(int v, int p = -1) {
        int deg = graph[v].size();
        dp[v].resize(deg);
        T dp_cum = id;
        for (int i = 0; i < deg; ++i) {
            if (graph[v][i] == p) continue;
            dp[v][i] = dfs1(graph[v][i], v);
            dp_cum = merge(dp_cum, f(dp[v][i], graph[v][i]));
        }
        return g(dp_cum, v);
    }

    void dfs2(int v, T dp_p, int p = -1) {
        int deg = graph[v].size();
        for (int i = 0; i < deg; ++i) {
            if (graph[v][i] == p) {
                dp[v][i] = dp_p;
                break;
            }
        }
        vector<T> dp_l(deg + 1, id), dp_r(deg + 1, id);
        for (int i = 0; i < deg; ++i) dp_l[i+1] = merge(dp_l[i], f(dp[v][i], graph[v][i]));
        for (int i = deg - 1; i >= 0; --i) dp_r[i] = merge(f(dp[v][i], graph[v][i]), dp_r[i+1]);
        for (int i = 0; i < deg; ++i) {
            if (graph[v][i] == p) continue;
            dfs2(graph[v][i], g(merge(dp_l[i], dp_r[i+1]), v), v);
        }
    }

    void build() {
        dfs1(0);
        dfs2(0, id);
    }

    T solve(int v) {
        T ans = id;
        int deg = graph[v].size();
        for (int i = 0; i < deg; ++i) {
            ans = merge(ans, f(dp[v][i], graph[v][i]));
        }
        return g(ans, v);
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    init(n);

    using P = pair<mint, int>;
    auto f = [](P a, int b) {
        (void)b;
        a.first *= ifact[a.second];
        return a;
    };
    auto g = [](P a, int b) {
        (void)b;
        a.first *= fact[a.second];
        a.second += 1;
        return a;
    };
    auto merge = [](P a, P b) {
        P res;
        res.first = a.first * b.first;
        res.second = a.second + b.second;
        return res;
    };
    rerooting<P> re(n, f, g, merge, P(1, 0));

    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        re.add_edge(a, b);
    }
    re.build();
    rep(i, n) cout << re.solve(i).first << '\n';
}


Measured memory_bytes: 38376