#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

template <int64_t MOD>
class Modint {
  using Self = Modint<MOD>;

  int64_t m_value;

 public:
  Modint() : m_value(0) {}
  Modint(int64_t value) : m_value((value % MOD + MOD) % MOD) {}
  Self pow(int64_t e) const {
    if (e == 0) {
      return (Self)1;
    } else if (e % 2 == 0) {
      return ((*this) * (*this)).pow(e / 2);
    } else {
      return (*this).pow(e - 1) * (*this);
    }
  }
  Self inv() const { return pow(MOD - 2); }
  Self& operator=(const Self& rh) {
    m_value = rh.m_value;
    return *this;
  }
  Self operator-() const { return Self(-m_value); }
  Self operator+(const Self& other) const {
    return Self(m_value + other.m_value);
  }
  Self operator-(const Self& other) const {
    return Self(m_value - other.m_value);
  }
  Self operator*(const Self& other) const {
    return Self(m_value * other.m_value);
  }
  Self operator/(const Self& other) const { return (*this) * other.inv(); }
  Self& operator+=(const Self& rh) { return (*this) = (*this) + rh; }
  Self& operator-=(const Self& rh) { return (*this) = (*this) - rh; }
  Self& operator*=(const Self& rh) { return (*this) = (*this) * rh; }
  Self& operator/=(const Self& rh) { return (*this) = (*this) / rh; }
  int64_t value() const { return m_value; }
};

using Mint = Modint<1'000'000'007L>;
int N;
vector<vector<int>> edge;
vector<bool> is_visited;

vector<int> size;
void calc_size(int node) {
  is_visited[node] = true;
  size[node] = 1;
  for (int c : edge[node]) {
    if (!is_visited[c]) {
      calc_size(c);
      size[node] += size[c];
    }
  }
}

vector<Mint> fact;

vector<Mint> dp1;
void dfs1(int node) {
  is_visited[node] = true;
  dp1[node] = fact[size[node] - 1];

  Mint d = 1;
  for (int c : edge[node]) {
    if (!is_visited[c]) {
      dfs1(c);
      dp1[node] *= dp1[c];
      d *= fact[size[c]];
    }
  }
  dp1[node] /= d;
}

vector<Mint> dp2;
void dfs2(int node, Mint p) {
  is_visited[node] = true;
  dp2[node] = p;

  Mint f = p / fact[N - size[node]];

  for (int c : edge[node]) {
    if (!is_visited[c]) {
      f *= dp1[c];
      f /= fact[size[c]];
    }
  }

  for (int c : edge[node]) {
    if (!is_visited[c]) {
      dfs2(c, fact[N - size[c] - 1] * f * fact[size[c]] / dp1[c]);
    }
  }
}

vector<Mint> result;
void dfs3(int node) {
  is_visited[node] = true;

  result[node] = fact[N - 1] * dp2[node];
  Mint d = fact[N - size[node]];

  for (int c : edge[node]) {
    if (!is_visited[c]) {
      result[node] *= dp1[c];
      d *= fact[size[c]];
      dfs3(c);
    }
  }
  result[node] /= d;
}

int main() {
  cin >> N;

  edge.resize(N);
  rep(i, N - 1) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }

  is_visited.resize(N);

  size.resize(N);
  fill(is_visited.begin(), is_visited.end(), false);
  calc_size(0);

  fact.resize(N + 1);
  fact[0] = 1;
  rep(i, N) { fact[i + 1] = fact[i] * (i + 1); }

  dp1.resize(N);
  fill(is_visited.begin(), is_visited.end(), false);
  dfs1(0);

  dp2.resize(N);
  fill(is_visited.begin(), is_visited.end(), false);
  dfs2(0, 1);

  result.resize(N);
  fill(is_visited.begin(), is_visited.end(), false);
  dfs3(0);

  rep(i, N) { cout << result[i].value() << "\n"; }

  return 0;
}

Measured memory_bytes: 20980