#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl '\n'
//#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define BIT(n) (1LL << (n))
#define TOUPPER(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define TOLOWER(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define FILLZERO(s, n)                      \
    do {                                    \
        ostringstream os;                   \
        os << setw(n) << setfill('0') << s; \
        s = os.str();                       \
    } while (0);
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
#define INIT                               \
    std::cin.tie(nullptr);                 \
    std::ios_base::sync_with_stdio(false); \
    cout << std::fixed << std::setprecision(10);

using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pi = pair<int, int>;
template <typename T>
using Pq = priority_queue<T>;
template <typename T>
using pQ = priority_queue<T, vector<T>, greater<T>>;

template <typename T>
vector<T> make_vec(size_t a, T n) { return vector<T>(a, n); }
template <typename T, typename... Ts>
auto make_vec(size_t a, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); }
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

class Fp {
private:
    long long val;

public:
    static long long mod;

    Fp() { val = 0; }
    Fp(long long v) : val(v % mod) {
        if (val < 0)
            val += mod;
    }
    Fp getVal() { return val; }
    Fp operator+=(const Fp &in) {
        val += in.val;
        if (val >= mod)
            val -= mod;
        return *this;
    }
    Fp operator+(const Fp &in) const {
        return Fp(*this) += in;
    }
    Fp &operator-=(const Fp &in) {
        val -= in.val;
        if (val < 0)
            val += mod;
        return *this;
    }
    Fp operator-(const Fp &in) const {
        return Fp(*this) -= in;
    }
    Fp &operator*=(const Fp &in) {
        val = val * in.val % mod;
        return *this;
    }
    Fp operator*(const Fp &in) const {
        return Fp(*this) *= in;
    }
    friend Fp operator*(const long long n, const Fp &in) {
        return in * n;
    }
    Fp &operator/=(const Fp &in) {
        *this *= in.modpow(mod - 2);
        return *this;
    }
    Fp operator/(const Fp &in) const {
        return Fp(*this) /= in;
    }
    bool operator==(const Fp &in) const {
        return val == in.val;
    }
    bool operator!=(const Fp &in) const {
        return val != in.val;
    }
    Fp modpow(long long n) const {
        if (n == 0)
            return 1;
        if (n & 1) {
            return (*this) * ((*this) * (*this)).modpow(n / 2);
        } else {
            return ((*this) * (*this)).modpow(n / 2);
        }
    }
    friend istream &operator>>(istream &is, Fp &fp) {
        is >> fp.val;
        return is;
    }
    friend ostream &operator<<(ostream &os, Fp &fp) {
        os << fp.val;
        return os;
    }
    friend ostream &operator<<(ostream &os, Fp &&fp) {
        os << fp.val;
        return os;
    }
};

Fp modpow(const Fp &in, const long long n) {
    return in.modpow(n);
}
Fp modpow(const ll a, const long long n) {
    return Fp(a).modpow(n);
}

using mint = Fp;
long long mint::mod = MOD;

class Factorial {
public:
    vector<mint> fact, finv;
    Factorial(long long n) : fact(n + 1, mint(1)), finv(n + 1, mint(1)) {
        for (int i = 2; i <= n; i++) {
            mint tmp(i);
            fact[i] = fact[i - 1] * tmp;
            finv[i] = finv[i - 1] / tmp;
        }
    }
    mint perm(const long long n, const long long k) {
        return fact[n] * finv[n - k];
    }
    mint com(const long long n, const long long k) {
        if (n < k || n < 0 || k < 0)
            return mint(0);
        return fact[n] * finv[k] * finv[n - k];
    }
};

struct Edge {
    int from, to, cost;
    Edge(int from, int to, int cost = 1) : from(from), to(to), cost(cost) {}
};
//0-indexedに注意
class Graph {
public:
    int verN;
    int edgeN = 0;
    vector<Edge> edges;
    vector<vector<pair<int, int>>> adjList;
    int inf = numeric_limits<int>::max();
    Graph(int verN) : verN(verN), adjList(verN) {}

    void addDirectedEdge(int from, int to, int cost = 1) {
        edges.push_back(Edge(from, to, cost));
        adjList[from].push_back(make_pair(to, cost));
        edgeN++;
    }

    void addUndirectedEdge(int from, int to, int cost = 1) {
        edges.push_back(Edge(from, to, cost));
        edges.push_back(Edge(to, from, cost));
        adjList[from].push_back(make_pair(to, cost));
        adjList[to].push_back(make_pair(from, cost));
        edgeN += 2;
    }

    bool _cycleDetection(int now, int prev, vector<int> &seen, vector<int> &used, vector<int> &cycle) {
        if (used[now]) {
            return false;
        }
        if (seen[now]) {
            cycle.push_back(now);
            return true;
        }

        seen[now] = true;

        for (auto adj_pair : adjList[now]) {
            int adj = adj_pair.first;
            if (prev == adj)
                continue;
            bool hasDetected = _cycleDetection(adj, now, seen, used, cycle);
            if (hasDetected) {
                cycle.push_back(now);
                return true;
            }
        }
        used[now] = true;

        seen[now] = false;

        return false;
    }

    bool cycleDetection(vector<int> &cycle) {
        cycle.reserve(N);
        vector<int> seen(N);
        vector<int> used(N);
        for (int start = 0; start < N; start++) {
            bool hasDetected = _cycleDetection(start, -1, seen, used, cycle);
            if (hasDetected) {
                for (int i = 1; i < (int)cycle.size(); i++) {
                    if (cycle[i] == cycle[0]) {
                        cycle.erase(cycle.begin() + i + 1, cycle.end());
                    }
                }
                reverse(cycle.begin(), cycle.end());
                //cycle.pop_back();
                return 1;
            }
        }
        return 0;
    }

    int prim(int start, vector<int> &parent) {
        parent.resize(N);
        int cost = 0;
        using P = pair<int, pair<int, int>>;
        priority_queue<P, vector<P>, greater<P>> pq;
        vector<int> used(verN, 0);
        pq.push(make_pair(0, make_pair(start, start)));
        while (!pq.empty()) {
            auto tmp = pq.top();
            pq.pop();
            int now = tmp.second.first;
            if (used[now])
                continue;
            cost += tmp.first;
            parent[now] = tmp.second.second;
            used[now] = 1;
            for (auto [adj, dist] : adjList[now]) {
                if (used[adj])
                    continue;
                pq.push(make_pair(dist, make_pair(adj, now)));
            }
        }
        return cost;
    }

    //始点から行けるすべての負閉路を検出する。
    //始点関係なくあらゆる負閉路を検出したい場合、dをすべて0で初期化する。
    bool bellmanford(int start, vector<int> &d) {
        d.resize(verN);
        for (int i = 0; i < verN; i++) {
            d[i] = inf;
        }
        d[start] = 0;
        for (int i = 0; i < verN; i++) {
            for (int j = 0; j < edgeN; j++) {
                Edge e = edges[j];
                if (d[e.from] != inf && d[e.to] > d[e.from] + e.cost) {
                    d[e.to] = d[e.from] + e.cost;
                    if (i == verN - 1) {
                        return false;
                    }
                }
            }
        }
        return true;
    }

    //始点から終点へのパス上の不閉路を検出する。
    bool bellmanford(int start, int end, vector<int> &d) {
        d.resize(verN);
        vector<int> negative(verN);
        for (int i = 0; i < verN; i++) {
            d[i] = inf;
        }
        d[start] = 0;
        for (int i = 0; i < verN; i++) {
            for (int j = 0; j < edgeN; j++) {
                Edge e = edges[j];
                if (d[e.from] != inf && d[e.to] > d[e.from] + e.cost) {
                    d[e.to] = d[e.from] + e.cost;
                    if (i == verN - 1) {
                        negative[e.to] = true;
                    }
                }
            }
        }
        for (int i = 0; i < verN; i++) {
            for (int j = 0; j < edgeN; j++) {
                Edge e = edges[j];
                if (negative[e.from]) {
                    negative[e.to] = true;
                }
            }
        }
        return !negative[end];
    }

    vector<int> dijkstra(int start) {
        vector<int> d(verN, inf);
        d[start] = 0;
        priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
        vector<int> used(verN, 0);
        pq.push(make_pair(0, start));
        while (!pq.empty()) {
            int now = pq.top().second;
            pq.pop();
            if (used[now])
                continue;
            used[now] = 1;
            for (auto [adj, dist] : adjList[now]) {
                if (used[adj])
                    continue;
                if (d[adj] > d[now] + dist) {
                    d[adj] = d[now] + dist;
                    pq.push(make_pair(d[adj], adj));
                }
            }
        }
        return d;
    }

    vector<vector<int>> warshallfloyd() {
        vector<vector<int>> d(verN, vector<int>(verN, inf));
        for (int i = 0; i < verN; i++) {
            for (auto [adj, dist] : adjList[i]) {
                d[i][adj] = dist;
            }
        }
        for (int i = 0; i < verN; i++) {
            d[i][i] = 0;
        }
        for (int k = 0; k < verN; k++) {         // 経由する頂点
            for (int i = 0; i < verN; i++) {     // 始点
                for (int j = 0; j < verN; j++) { // 終点
                    if (d[i][k] != inf && d[k][j] != inf)
                        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                }
            }
        }
        return d;
    }

    vector<int> topologicalSort() {
        vector<int> res;
        vector<int> used(N);
        auto dfs = [&](auto &&dfs, int now, vector<int> &res) -> void {
            if (used[now])
                return;
            used[now] = 1;
            for (auto [nxt, _] : adjList[now]) {
                dfs(dfs, nxt, res);
            }
            res.push_back(now);
        };
        for (int i = 0; i < N; i++) {
            dfs(dfs, i, res);
        }
        reverse(res.begin(), res.end());
        return res;
    }
};

class Tree : public Graph {
public:
    vector<int> depth;
    vector<int> parent;
    vector<int> size;
    int root;
    Tree(int verN, vector<Edge> &edges, int root) : Graph(verN), depth(verN), parent(verN), size(verN), root(root) {
        if ((int)edges.size() != verN - 1) {
            fprintf(stderr, "This tree is invalid.");
            exit(1);
        }
        for (int i = 0; i < verN - 1; i++) {
            addUndirectedEdge(edges[i].from, edges[i].to, edges[i].cost);
        }
        setRoot(root);
    }

    void setRoot(int root) {
        auto dfs = [&](auto &&dfs, int node, int d) -> int {
            int res = 0;
            depth[node] = d;
            for (auto [nxt, _] : adjList[node]) {
                if (parent[node] == nxt) {
                    continue;
                }
                parent[nxt] = node;
                size[nxt] = dfs(dfs, nxt, d + 1);
                res += size[nxt];
            }
            return res + 1;
        };
        parent[root] = -1;
        size[0] = dfs(dfs, root, 0);
    }
    //dpv=merge(f(dpc1), f(dpc2), ..., f(dpck)) (ci∈ch(v))の遷移に対応できる
    //下記の簡易バージョン
    //dpv=g(merge(f(dpc1, c1), f(dpc2, c2), ...,　f(dpck,　ck)),v)　(ci∈ch(v))(参考：https://null-mn.hatenablog.com/entry/2020/04/14/124151)
    template <typename dp_t>
    vector<dp_t> rerooting(const dp_t identity, function<dp_t(dp_t, dp_t)> merge, function<dp_t(dp_t)> f) {
        vector<vector<dp_t>> dp(N); //dp[v][i]:vから出るi番目の辺に対応する部分木
        for (int n = 0; n < verN; n++) {
            dp[n].resize(adjList[n].size(), identity);
        }
        auto dfs1 = [&](auto &&dfs1, int now) -> dp_t {
            dp_t res = identity;
            int deg = adjList[now].size();
            for (int ei = 0; ei < deg; ei++) {
                int nxt = adjList[now][ei].first;
                if (nxt == parent[now])
                    continue;
                dp[now][ei] = dfs1(dfs1, nxt);
                res = merge(res, dp[now][ei]);
            }
            return f(res);
        };
        auto dfs2 = [&](auto &&dfs2, int now, dp_t dpPar) -> void {
            int deg = adjList[now].size();
            vector<dp_t> sumL(deg + 1, identity);
            vector<dp_t> sumR(deg + 1, identity);
            for (int ei = 0; ei < deg; ei++) {
                int nxt = adjList[now][ei].first;
                if (parent[now] == nxt)
                    dp[now][ei] = dpPar;
            }
            for (int ei = 0; ei < deg; ei++) {
                sumL[ei + 1] = merge(sumL[ei], dp[now][ei]);
            }
            for (int ei = deg - 1; ei >= 0; ei--) {
                sumR[ei] = merge(sumR[ei + 1], dp[now][ei]);
            }
            dump(now, sumL, sumR);
            for (int ei = 0; ei < deg; ei++) {
                int nxt = adjList[now][ei].first;
                if (parent[now] == nxt)
                    continue;
                dfs2(dfs2, nxt, f(merge(sumL[ei], sumR[ei + 1])));
            }
        };
        dfs1(dfs1, 0);
        dump(dp);
        dfs2(dfs2, 0, identity);
        dump(dp);
        vector<dp_t> res(N, identity);
        for (int n = 0; n < verN; n++) {
            for (int ei = 0; ei < (int)adjList[n].size(); ei++) {
                res[n] = merge(res[n], dp[n][ei]);
            }
        }
        return res;
    }

    int lca(int u, int v) {
        static int hasPreprocessed = false;
        static int logV = 0;
        static vector<vector<int>> doubling;
        if (!hasPreprocessed) {
            int V = verN;
            while (V > 0) {
                V >>= 1;
                logV++;
            }
            doubling.resize(logV);
            for (int k = 0; k < logV; k++) {
                doubling[k].resize(N);
            }
            doubling[0] = parent;
            for (int k = 0; k < logV - 1; k++) {
                for (int i = 0; i < verN; i++) {
                    if (doubling[k][i] < 0)
                        doubling[k + 1][i] = -1;
                    else
                        doubling[k + 1][i] = doubling[k][doubling[k][i]];
                }
            }
            hasPreprocessed = true;
        }
        if (depth[u] > depth[v])
            swap(u, v);
        for (int k = 0; k < logV; k++) {
            if (((depth[v] - depth[u]) >> k) & 1) {
                v = doubling[k][v];
            }
        }
        if (u == v)
            return u;
        for (int k = logV - 1; k >= 0; k--) {
            if (doubling[k][u] != doubling[k][v]) {
                u = doubling[k][u];
                v = doubling[k][v];
            }
        }
        return doubling[0][u];
    }
};

int main() {
    INIT;
    cin >> N;
    vector<Edge> edges;
    REP(i, N - 1) {
        cin >> A >> B;
        A--, B--;
        edges.push_back({A, B});
    }
    Factorial f(N);
    Tree t(N, edges, 0);
    using dp_t = pair<mint, int>;
    function<dp_t(dp_t, dp_t)> merge = [&](dp_t l, dp_t r) -> dp_t {
        return {l.first * r.first * f.com(l.second + r.second, l.second), l.second + r.second};
    };
    function<dp_t(dp_t)> g = [&](dp_t x) -> dp_t {
        return dp_t(x.first, x.second + 1);
    };
    dp_t identity = {1, 0};
    auto res = t.rerooting(identity, merge, g);
    REP(i, N)
    cout << res[i].first << endl;
}

Measured memory_bytes: 48636