#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using uInt = long long unsigned int;
using Double = long double;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Mint {
    using u64 = std::uint_fast64_t;
    u64 Modulus = MOD;

public:
    u64 a;

    constexpr Mint(const u64 x = 0) noexcept : a(x % Modulus) {}

    constexpr u64 &value() noexcept { return a; }

    constexpr const u64 &value() const noexcept { return a; }

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

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

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

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

    constexpr Mint &operator+=(const Mint rhs) noexcept {
        a += rhs.a;
        if (a >= Modulus) {
            a -= Modulus;
        }
        return *this;
    }

    constexpr Mint &operator-=(const Mint rhs) noexcept {
        if (a < rhs.a) {
            a += Modulus;
        }
        a -= rhs.a;
        return *this;
    }

    constexpr Mint &operator*=(const Mint rhs) noexcept {
        a = a * rhs.a % Modulus;
        return *this;
    }

    constexpr Mint &operator/=(Mint rhs) noexcept {
        u64 exp = Modulus - 2;
        while (exp) {
            if (exp % 2) {
                *this *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
        }
        return *this;
    }

    constexpr Mint pow(int rhs) noexcept {
        Mint ret(1);
        Mint base(a);
        u64 exp = static_cast<u64>(rhs);
        while (exp) {
            if (exp % 2) {
                ret *= base;
            }
            base *= base;
            exp /= 2;
        }
        return ret;
    }

};


class Combination {
public:
    vector<Mint> fact;
    vector<Mint> ifact;

    Combination(int n) {
        fact.resize(static_cast<unsigned long>(n + 1));
        ifact.resize(static_cast<unsigned long>(n + 1));

        fact[0] = ifact[0] = Mint(1);
        for (int i = 1; i <= n; ++i) {
            fact[i] = fact[i - 1] * Mint(i);
            ifact[i] = Mint(1) / fact[i];
        }
    }

    Mint nPk(Int n, Int k) {
        return fact[n] * ifact[n - k];
    }

    Mint nCk(Int n, Int k) {
        return fact[n] * ifact[n - k] * ifact[k];
    }

    Mint nHk(Int n, Int k) {
        return nCk(n + k - 1, k - 1);
    }
};

Combination cmb(300000);

class Solve {
public:
    Int N;
    vector<vector<Int>> G;
    vector<vector<Mint>> dp;
    vector<vector<Int>> sz;
    vector<Int> pid;

    Int dfs_sz1(Int v = 0, Int p = -1) {
        Int ret = 1;
        for (int i = 0; i < G[v].size(); ++i) {
            if (G[v][i] == p) {
                pid[v] = i;
            } else {
                Int tmp = dfs_sz1(G[v][i], v);
                ret += tmp;
                sz[v][i] = tmp;
            }
        }
        return ret;
    }

    void dfs_sz2(Int v = 0, Int psz = 0) {
        Int sum = 0;
        for (int i = 0; i < G[v].size(); ++i) {
            if (i == pid[v]) {
                sz[v][i] = psz;
            }
            sum += sz[v][i];
        }

        for (int i = 0; i < G[v].size(); ++i) {
            if (i != pid[v]) {
                dfs_sz2(G[v][i], sum - sz[v][i] + 1);
            }
        }
    }

    Mint dfs_dp1(Int v = 0, Int p = -1) {
        vector<Int> csz;

        Mint ret = 1;
        for (int i = 0; i < G[v].size(); ++i) {
            if (G[v][i] != p) {
                Mint tmp = dfs_dp1(G[v][i], v);
                dp[v][i] = tmp;

                csz.push_back(sz[v][i]);
                ret *= dp[v][i];
            }
        }
        Int sum_c = accumulate(all(csz), 0ll);
        ret *= cmb.fact[sum_c];
        for (auto e : csz) {
            ret *= cmb.ifact[e];
        }

        return ret;
    }

    void dfs_dp2(Int v = 0, Mint pdp = 0) {
        Mint X = cmb.fact[N - 1];
        for (int i = 0; i < G[v].size(); ++i) {
            if (i == pid[v]) {
                dp[v][i] = pdp;
            }

            X *= cmb.ifact[sz[v][i]];
            X *= dp[v][i];
        }

        for (int i = 0; i < G[v].size(); ++i) {
            if (i != pid[v]) {
                Mint npdp = X;
                npdp *= cmb.ifact[N - 1];
                npdp *= cmb.fact[N - 1 - sz[v][i]];
                npdp *= cmb.fact[sz[v][i]];
                npdp /= dp[v][i];
                dfs_dp2(G[v][i], npdp);
            }
        }
    }

    Mint calc(Int v) {
        vector<Int> csz;

        Mint ret = 1;
        for (int i = 0; i < G[v].size(); ++i) {
            csz.push_back(sz[v][i]);
            ret *= dp[v][i];
        }

        Int sum_c = accumulate(all(csz), 0ll);
        ret *= cmb.fact[sum_c];
        for (auto e : csz) {
            ret *= cmb.ifact[e];
        }

        return ret;
    }

    void solve() {
        cin >> N;
        G.resize(N);
        dp.resize(N);
        sz.resize(N);
        pid.resize(N, -1);

        for (int i = 1; i < N; ++i) {
            Int a, b;
            cin >> a >> b;
            a--, b--;
            G[a].push_back(b);
            G[b].push_back(a);
            sz[a].push_back(0);
            sz[b].push_back(0);
            dp[a].push_back(0);
            dp[b].push_back(0);
        }

        dfs_sz1();
        dfs_sz2();
        dfs_dp1();
        dfs_dp2();


        for (int i = 0; i < N; ++i) {
            Mint tmp = calc(i);
            cout << tmp.value() << endl;
        }

    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 56236