/*
https://github.com/key-moon/Library/blob/master/src/Algorithm/rerooting.csx
keymoon による C# の実装を noshi91 が C++ に移植し、高速化したものです
*/

#include <stack>
#include <vector>

template <class T, class OperateF, class OperateNodeF> class ReRooting {
public:
    int NodeCount;

private:
    std::vector<std::vector<int>> Adjacents;
    std::vector<std::vector<int>> IndexForAdjacent;

    std::vector<T> Res;
    std::vector<std::vector<T>> DP;

    T Identity;
    OperateF Operate;
    OperateNodeF OperateNode;

public:
    ReRooting(int nodeCount, const std::vector<std::vector<int>> &edges,
                T identity, OperateF operate, OperateNodeF operateNode) :
                NodeCount(nodeCount),
                Adjacents(nodeCount),
                IndexForAdjacent(nodeCount),
                Res(nodeCount),
                DP(nodeCount),
                Identity(identity),
                Operate(operate),
                OperateNode(operateNode) {
        for (int i = 0; i < edges.size(); i++) {
            auto &edge = edges[i];
            IndexForAdjacent[edge[0]].push_back(Adjacents[edge[1]].size());
            IndexForAdjacent[edge[1]].push_back(Adjacents[edge[0]].size());
            Adjacents[edge[0]].push_back(edge[1]);
            Adjacents[edge[1]].push_back(edge[0]);
        }

        for (int i = 0; i < Adjacents.size(); i++)
            DP[i] = std::vector<T>(Adjacents[i].size());
        if (NodeCount > 1)
            Initialize();
        else if (NodeCount == 1)
            Res[0] = OperateNode(Identity, 0);
    }

    T Query(int node) { return Res[node]; }

private:
    void Initialize() {
        std::vector<int> parents(NodeCount);
        std::vector<int> order(NodeCount);

#pragma region InitOrderedTree
        int index = 0;
        std::stack<int> stack;
        stack.push(0);
        parents[0] = -1;
        while (stack.size() > 0) {
            auto node = stack.top();
            stack.pop();
            order[index++] = node;
            for (int i = 0; i < Adjacents[node].size(); i++) {
                auto adjacent = Adjacents[node][i];
                if (adjacent == parents[node])
                    continue;
                stack.push(adjacent);
                parents[adjacent] = node;
            }
        }
#pragma endregion

#pragma region fromLeaf
        for (int i = order.size() - 1; i >= 1; i--) {
            auto node = order[i];
            auto parent = parents[node];

            T accum = Identity;
            int parentIndex = -1;
            for (int j = 0; j < Adjacents[node].size(); j++) {
                if (Adjacents[node][j] == parent) {
                    parentIndex = j;
                    continue;
                }
                accum = Operate(accum, DP[node][j]);
            }
            DP[parent][IndexForAdjacent[node][parentIndex]] =
                OperateNode(accum, node);
        }
#pragma endregion

#pragma region toLeaf
        for (int i = 0; i < order.size(); i++) {
            auto node = order[i];
            T accum = Identity;
            std::vector<T> accumsFromTail(Adjacents[node].size());
            accumsFromTail[accumsFromTail.size() - 1] = Identity;
            for (int j = accumsFromTail.size() - 1; j >= 1; j--)
                    accumsFromTail[j - 1] = Operate(DP[node][j], accumsFromTail[j]);
            for (int j = 0; j < accumsFromTail.size(); j++) {
                DP[Adjacents[node][j]][IndexForAdjacent[node][j]] =
                    OperateNode(Operate(accum, accumsFromTail[j]), node);
                accum = Operate(accum, DP[node][j]);
            }
            Res[node] = OperateNode(accum, node);
        }
#pragma endregion
    }
};

template <class T, class OperateF, class OperateNodeF>
auto make_rerooting(int nodeCount, std::vector<std::vector<int>> edges, T identity,
                OperateF operate, OperateNodeF operateNode) {
    return ReRooting<T,OperateF, OperateNodeF>(nodeCount, edges, identity, operate, operateNode);
}

#include <cstdint>

template <std::uint_fast64_t mod> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 v;

  constexpr modint(const u64 x = 0) noexcept : v(x % mod) {}
  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 {
    v += rhs.v;
    if (v >= mod)
      v -= mod;
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (v < rhs.v)
      v += mod;
    v -= rhs.v;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    v = v * rhs.v % mod;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = mod - 2;
    while (exp != 0) {
      if (exp % 2 != 0)
        *this *= rhs;
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

#include <iostream>
#include <vector>

int main() {
  using mint = modint<1000000007>;

  struct Data {
    mint comb;
    int size;
  };

  int n;
  std::cin >> n;
  std::vector<mint> fact(n + 1), invf(n + 1);
  fact[0] = 1;
  for (int i = 0; i < n; i++)
    fact[i + 1] = fact[i] * (i + 1);
  invf[n] = mint(1) / fact[n];
  for (int i = n; i > 0; i--)
    invf[i - 1] = invf[i] * i;
  std::vector<std::vector<int>> edges;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    std::cin >> a >> b;
    edges.push_back({a - 1, b - 1});
  }
  auto res = make_rerooting(n, edges, Data({1, 0}),
                      [&](auto &&x, auto &&y) {
                        int newsize = x.size + y.size;
                        return Data({x.comb * y.comb * fact[newsize] *
                                         invf[x.size] * invf[y.size],
                                     newsize});
                      },
                      [](auto &&x, auto &&) {
                        return Data({x.comb, x.size + 1});
                      });
  auto res2 = make_rerooting(n, edges, Data({1, 0}),
                      [&](auto &&x, auto &&y) {
                        int newsize = x.size + y.size;
                        return Data({x.comb * y.comb * fact[newsize] *
                                         invf[x.size] * invf[y.size],
                                     newsize});
                      },
                      [](auto &&x, auto &&) {
                        return Data({x.comb, x.size + 1});
                      });
  for (int i = 0; i < n; i++) {
    std::cout << res.Query(i).comb.v << "\n";
  }
}


Measured memory_bytes: 115108