#include <bits/stdc++.h>

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

struct Edge {
  const int from, to;
  Edge(int from, int to) : from(from), to(to) {}
};

vector<vector<Edge>> ReadUndirectedGraph(
    int n, int m, bool is_one_indexed=false) {
  vector<vector<Edge>> graph(n);
  for (int i = 0; i < m; i++) {
    int v1, v2;
    cin >> v1 >> v2;
    if (is_one_indexed) {
      v1--;
      v2--;
    }
    graph[v1].push_back(Edge(v1, v2));
    graph[v2].push_back(Edge(v2, v1));
  }
  return graph;
}

constexpr int64 P = 1000000007;

struct FiniteField {
 private:
  int64 x;
 public:
  FiniteField(int64 raw_x) : x(raw_x) {
    if (x >= P || x < 0) {
    x %= P;
    if (x < 0) x += P;
  }
}
  FiniteField() : x(0) {}
  int64 Value() const { return x; }
  inline FiniteField operator+(FiniteField o) const {
    FiniteField r(*this); r += o; return r;
  }
  inline FiniteField operator-(FiniteField o) const {
    FiniteField r(*this); r -= o; return r;
  }
  inline FiniteField operator* (FiniteField o) const {
    FiniteField r(*this); r *= o; return r;
  }
  inline FiniteField operator/ (FiniteField o) const {
    FiniteField r(*this); r /= o; return r;
  }
  inline void operator+= (FiniteField o) { x = (x + o.x) % P; }
  inline void operator-= (FiniteField o) { x = (x + P - o.x) % P; }
  inline void operator*= (FiniteField o) { x = (x * o.x) % P; }
  void operator/=(FiniteField o) {
    int64 p = P - 2; while (p) { if (p % 2) { *this *= o; } o *= o; p /= 2; }
  }
};
ostream& operator<<(ostream& s, const FiniteField& x) { s << x.Value(); return s; }

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

  int n;
  cin >> n;

  vector<FiniteField> factorials(n + 1);
  factorials[0] = 1;
  for (int i = 1; i <= n; i++) {
    factorials[i] = factorials[i - 1] * i;
  }

  auto graph = ReadUndirectedGraph(n, n - 1, true);

  vector<pair<FiniteField, int>> dp(n);
  
  function<void(int, int)> dfs_1_fn = [&](int v, int p) {
    FiniteField r = 1;
    int c = 0;
    for (const auto& e : graph[v]) {
      if (e.to == p) continue;
      dfs_1_fn(e.to, v);
      r *= dp[e.to].first;
      c += dp[e.to].second;
      r /= factorials[dp[e.to].second];
    }
    r *= factorials[c];
    c++;

    dp[v] = {r, c};
  };

  dfs_1_fn(0, -1);

  vector<FiniteField> ans(n);

  function<void(int, int, FiniteField, int)> dfs_2_fn = [&](int v, int p, FiniteField pc, int ps) {
    // cout << "v: " << v << " p: " << p << " pc: " << pc << " ps: " << ps << endl;

    FiniteField c = 1;
    int s = 0;
    for (const auto& e : graph[v]) {
      if (e.to == p) continue;
      c *= dp[e.to].first;
      s += dp[e.to].second;
      c /= factorials[dp[e.to].second];
    }
    c *= pc;
    s += ps;
    c /= factorials[ps];
    c *= factorials[s];

    ans[v] = c;

    vector<int> c_vs;
    for (const auto& e : graph[v]) {
      if (e.to == p) continue;
      c_vs.push_back(e.to);
    }

    vector<FiniteField> l_cs(c_vs.size() + 1);
    vector<int> l_ss(c_vs.size() + 1);
    vector<FiniteField> r_cs(c_vs.size() + 1);
    vector<int> r_ss(c_vs.size() + 1);

    l_cs[0] = 1;
    l_ss[0] = 0;
    for (int i = 0; i < c_vs.size(); i++) {
      l_cs[i + 1] = l_cs[i] * dp[c_vs[i]].first;
      l_cs[i + 1] /= factorials[dp[c_vs[i]].second];
      l_ss[i + 1] = l_ss[i] + dp[c_vs[i]].second;
    }

    r_cs[c_vs.size()] = 1;
    r_ss[c_vs.size()] = 0;
    for (int i = c_vs.size() - 1; i >= 0; i--) {
      r_cs[i] = r_cs[i + 1] * dp[c_vs[i]].first;
      r_cs[i] /= factorials[dp[c_vs[i]].second];
      r_ss[i] = r_ss[i + 1] + dp[c_vs[i]].second;
    }

    for (int i = 0; i < c_vs.size(); i++) {
      FiniteField c = pc * l_cs[i] * r_cs[i + 1];
      int s = l_ss[i] + r_ss[i + 1] + ps;
      c /= factorials[ps];
      c *= factorials[s];
      dfs_2_fn(c_vs[i], v, c, s + 1);
    }
  };

  dfs_2_fn(0, -1, 1, 0);

  for (int v = 0; v < n; v++) {
    cout << ans[v] << "\n";
  }
}

Measured memory_bytes: 27624