#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

struct mint {
    lint v;
    lint _mod;
    mint() : v(0) {}
    mint(signed v, lint _mod = mod) : v(v), _mod(_mod) {}
    mint(lint t, lint _mod = mod) : _mod(_mod) {
        v = t % _mod;
        if (v < 0)
            v += _mod;
    }

    mint pow(lint k) {
        mint res(1), tmp(v);
        while (k) {
            if (k & 1)
                res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    static mint add_identity() { return mint(0); }
    static mint mul_identity() { return mint(1); }
    mint inv() { return pow(_mod - 2); }

    mint &operator+=(mint a) {
        v += a.v;
        if (v >= _mod)
            v -= _mod;
        return *this;
    }
    mint &operator-=(mint a) {
        v += _mod - a.v;
        if (v >= _mod)
            v -= _mod;
        return *this;
    }
    mint &operator*=(mint a) {
        v = v * a.v % _mod;
        return *this;
    }
    mint &operator/=(mint a) { return (*this) *= a.inv(); }

    mint operator+(mint a) const { return mint(v) += a; };
    mint operator-(mint a) const { return mint(v) -= a; };
    mint operator*(mint a) const { return mint(v) *= a; };
    mint operator/(mint a) const { return mint(v) /= a; };

    mint operator-() const { return v ? mint(_mod - v) : mint(v); }

    bool operator==(const mint a) const { return v == a.v; }
    bool operator!=(const mint a) const { return v != a.v; }
    bool operator<(const mint a) const { return v < a.v; }
};
ostream &operator<<(ostream &os, mint m) { return os << m.v; }

template <typename Data, typename T>
struct ReRooting {

    struct Node {
        int to, rev;
        Data data;
    };

    using F1 = function<T(T, T)>;
    using F2 = function<T(T, Data)>;

    vector<vector<Node>> g;
    vector<vector<T>> ldp, rdp;
    vector<int> lptr, rptr;
    const F1 f1;
    const F2 f2;
    const T ident;

    ReRooting(int n, const F1 &f1, const F2 &f2, const T &ident)
        : g(n), ldp(n), rdp(n), lptr(n), rptr(n), f1(f1), f2(f2), ident(ident) {}

    void add_edge(int u, int v, const Data &d) {
        g[u].emplace_back((Node){v, (int)g[v].size(), d});
        g[v].emplace_back((Node){u, (int)g[u].size() - 1, d});
    }

    void add_edge_bi(int u, int v, const Data &d, const Data &e) {
        g[u].emplace_back((Node){v, (int)g[v].size(), d});
        g[v].emplace_back((Node){u, (int)g[u].size() - 1, e});
    }

    T dfs(int idx, int par) {

        while (lptr[idx] != par && lptr[idx] < g[idx].size()) {
            auto &e                 = g[idx][lptr[idx]];
            ldp[idx][lptr[idx] + 1] = f1(ldp[idx][lptr[idx]], f2(dfs(e.to, e.rev), e.data));
            ++lptr[idx];
        }
        while (rptr[idx] != par && rptr[idx] >= 0) {
            auto &e             = g[idx][rptr[idx]];
            rdp[idx][rptr[idx]] = f1(rdp[idx][rptr[idx] + 1], f2(dfs(e.to, e.rev), e.data));
            --rptr[idx];
        }
        if (par < 0)
            return rdp[idx][0];
        return f1(ldp[idx][par], rdp[idx][par + 1]);
    }

    vector<T> solve() {
        for (int i = 0; i < g.size(); i++) {
            ldp[i].assign(g[i].size() + 1, ident);
            rdp[i].assign(g[i].size() + 1, ident);
            lptr[i] = 0;
            rptr[i] = (int)g[i].size() - 1;
        }
        vector<T> ret;
        for (int i = 0; i < g.size(); i++) {
            ret.push_back(dfs(i, -1));
        }
        return ret;
    }
};

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n;
    cin >> n;
    // ReRooting<mint, mint> rr(n, f1, f2, 1);
    vector<vector<int>> edges(n);
    for (int i = 0; i < n - 1; ++i) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        edges[u].emplace_back(v);
        edges[v].emplace_back(u);
        // rr.add_edge(u, v, 1);
    }
    int root = 0;
    vector<lint> ch(n, 0), depth(n, 0);
    function<void(int, int)> dfs1 = [&](int c, int p) {
        for (auto &v : edges[c]) {
            if (v == p)
                continue;
            depth[v] = depth[c] + 1;
            dfs1(v, c);
        }
    };
    dfs1(root, -1);
    function<void(int, int)> dfs2 = [&](int c, int p) {
        for (auto &v : edges[c]) {
            if (v == p)
                continue;
            dfs2(v, c);
            ch[c] += ch[v] + 1;
        }
    };
    dfs2(root, -1);
    vector<mint> facto(n, 1);
    for (int i = 2; i < n; ++i) {
        facto[i] = facto[i - 1] * i;
    }
    vector<mint> dp1(n, 0);
    function<void(int, int)> dfs3 = [&](int c, int p) {
        mint cnt = 1;
        for (auto &v : edges[c]) {
            if (v == p)
                continue;
            dfs3(v, c);
            cnt *= dp1[v];
            cnt /= facto[ch[v] + 1];
        }
        cnt *= facto[ch[c]];
        dp1[c] = cnt;
    };
    dfs3(root, -1);
    vector<mint> dp2(n, 0);
    dp2[0]                        = dp1[0];
    function<void(int, int)> dfs4 = [&](int c, int p) {
        if (c == root)
            dp2[c] = dp1[c];
        else {
            mint rp = dp2[p];
            rp /= facto[n - 1];
            rp *= facto[n - 1 - (ch[c] + 1)];
            rp *= facto[(ch[c] + 1)];
            rp /= dp1[c];
            mint rc = dp1[c];
            rc /= facto[ch[c]];
            rc *= facto[n - 1];
            rc /= facto[n - 1 - ch[c]];
            rc *= rp;
            dp2[c] = rc;
        }
        for (auto &v : edges[c]) {
            if (v == p)
                continue;
            dfs4(v, c);
        }
    };
    dfs4(root, -1);
    for (int i = 0; i < n; ++i) {
        cout << dp2[i] << "\n";
    }
    return 0;
}

Measured memory_bytes: 26484