#include "bits/stdc++.h"
using namespace std;
typedef long long li;


template <long long mod>
struct modint {
    long long x;

    modint<mod>(): x(0LL) {}
    modint<mod>(const long long _data) {
        if (_data < 0) {
            x = (_data % mod + mod) % mod;
        } else if (_data >= mod) {
            x = _data % mod;
        } else {
            x = _data;
        }
    }

    bool operator==(const modint<mod>& op) const {
        return x == op.x;
    }

    bool operator!=(const modint<mod>& op) const {
        return !((*this) == op);
    }

    modint<mod> operator-() const {
        if (x == 0) {
            return modint(0);
        }
        return modint(mod - x);
    }

    modint<mod> operator+(const modint<mod>& op) const {
        const long long newdata = x + op.x;
        if (newdata >= mod) {
            return modint<mod>(newdata - mod);
        } else {
            return modint<mod>(newdata);
        }
    }

    modint<mod>& operator+=(const modint<mod>& op) {
        x = (*this + op).x;
        return *this;
    }

    modint<mod> operator-(const modint<mod>& op) const {
        return *this + (-op);
    }

    modint<mod>& operator-=(const modint<mod>& op) {
        x = (*this - op).x;
        return *this;
    }

    modint<mod> operator*(const modint<mod>& op) const {
        return modint<mod>(x * op.x % mod);
    }

    modint<mod>& operator*=(const modint<mod>& op) {
        x = (*this * op).x;
        return *this;
    }

    modint<mod> pow(const long long n) const {
        if (n == 0) {
            return modint<mod>(1);
        }
        modint<mod> sq = pow(n / 2);
        if (n & 1) {
            return (*this) * sq * sq;
        } else {
            return sq * sq;
        }
    }

    modint<mod> inverse() const {
        return pow(mod - 2);
    }

    modint<mod> operator/(const modint<mod>& op) const {
        return (*this) * op.inverse();
    }

    modint<mod>& operator/=(const modint<mod>& op) {
        x = (*this / op).x;
        return *this;
    }

    friend modint<mod> operator/(const long long dividend, const modint<mod>& divisor) {
        return modint<mod>(dividend) / divisor;
    }

    static long long non_ord(long long x) {
        while (x % mod == 0) {
            x /= mod;
        }
        return x;
    }

    // returns n! / mod^(sum(ord(i))
    // normally equals to n!.
    static modint<mod> factorial(const long long n) {
        static vector<modint<mod>> cache(1, 1);
        while (cache.size() <= n) {
            modint<mod> next = cache.back() * non_ord(cache.size());
            cache.push_back(next);
        }
        return cache[n];
    }

    // returns mod^(sum(ord(i)) / n!
    static modint<mod> invfact(const long long n) {
        static vector<modint<mod>> cache(1, 1);

        while (cache.size() <= n) {
            modint<mod> next = cache.back() / non_ord(cache.size());
            cache.push_back(next);
        }
        return cache[n];
    }

    static long long ordfact(const long long n) {
        static vector<long long> cache(1, 0);

        while (cache.size() <= n) {
            long long x = cache.size();
            long long ord_n = 0;
            while (x % mod == 0) {
                x /= mod;
                ord_n++;
            }
            cache.push_back(cache.back() + ord_n);
        }
        return cache[n];
    }

    static modint<mod> combination(const long long n, const long long k) {
        if (k < 0 || n < k) {
            return modint<mod>(0);
        }

        if (ordfact(n) > ordfact(k) + ordfact(n - k)) {
            return modint<mod>(0);
        }

        if (n < 1e7) {
            return factorial(n) * invfact(k) * invfact(n - k);
        }

        modint<mod> ret = 1;
        for (int i = 1; i <= k; ++i) {
            ret = ret * modint<mod>(n - i + 1) / modint<mod>(i);
        }
        return ret;
    }
};

typedef modint<1000000007> mint;

struct Rerooting {
    struct State {
        mint comb;
        li v;
    };

    static State get_initial_state() {
        return {1, 0};
    }

    static State merge(const State &a, const State &b) {
        return {a.comb * b.comb * mint::combination(a.v + b.v, b.v), a.v + b.v};
    }

    static State finalize_node(const State &a) {
        return {a.comb, a.v + 1};
    }

    // ====== implement above ======

    std::vector<std::vector<int>> tree;
    std::vector<State> upwards;
    std::vector<State> downwards;

    Rerooting(int n): tree(n), upwards(n), downwards(n) {}

    void add_edge(int a, int b) {
        tree[a].push_back(b);
        tree[b].push_back(a);
    }

    State upward_dfs(int pos, int parent) {
        State state = get_initial_state();
        for (int i = 0; i < tree[pos].size(); ++i) {
            const int next = tree[pos][i];
            if (next == parent) {
                continue;
            }
            state = merge(state, upward_dfs(next, pos));
        }
        return upwards[pos] = finalize_node(state);
    }

    void downward_dfs(int pos, int parent, State propagate) {
        vector<State> accumulates;
        accumulates.push_back(get_initial_state());
        for (int i = 0; i < tree[pos].size(); ++i) {
            const int next = tree[pos][i];
            const State state = (next == parent) ? propagate : upwards[next];
            accumulates.push_back(merge(accumulates.back(), state));
        }
        downwards[pos] = finalize_node(accumulates.back());

        State backwards_accumulate = get_initial_state();
        for (int i = tree[pos].size() - 1; i >= 0; --i) {
            const int next = tree[pos][i];
            if (next == parent) {
                backwards_accumulate = merge(backwards_accumulate, propagate);
            } else {
                State next_propagate = finalize_node(merge(accumulates[i], backwards_accumulate));
                downward_dfs(next, pos, next_propagate);
                backwards_accumulate = merge(backwards_accumulate, upwards[next]);
            }
        }
    }

    void calculate() {
        upward_dfs(0, -1);
        downward_dfs(0, -1, get_initial_state());
    }
};

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

    li n;
    cin >> n;

    Rerooting rerooting(n);
    for (int i = 0; i < n - 1; ++i) {
        li a, b;
        cin >> a >> b;
        a--; b--;
        rerooting.add_edge(a, b);
    }

    rerooting.calculate();

    for (int i = 0; i < n; ++i) {
        cout << rerooting.downwards[i].comb.x << '\n';
    }


    return 0;
}

Measured memory_bytes: 28776