#line 1 "/mnt/c/Users/leafc/dev/compro/lib/math/modint.hpp"
#include <cstdint>
#include <iostream>
#ifndef MOD_INT
#define MOD_INT

template <std::uint_fast64_t MOD> class ModInt {
  using u64 = std::uint_fast64_t;

public:
  ModInt(const u64 val = 0) { value = val % MOD; }

  ModInt operator+(const ModInt rhs) const { return ModInt(*this) += rhs; }
  ModInt operator-(const ModInt rhs) const { return ModInt(*this) -= rhs; }
  ModInt operator*(const ModInt rhs) const { return ModInt(*this) *= rhs; }
  ModInt operator/(const ModInt rhs) const { return ModInt(*this) /= rhs; }

  ModInt &operator+=(const ModInt rhs) {
    value += rhs.value;
    if (value >= MOD) {
      value -= MOD;
    }
    return *this;
  }

  ModInt &operator-=(const ModInt rhs) {
    if (value < rhs.value) {
      value += MOD;
    }
    value -= rhs.value;
    return *this;
  }

  ModInt &operator*=(const ModInt rhs) {
    value = value * rhs.value % MOD;
    return *this;
  }

  ModInt &operator/=(ModInt rhs) {
    *this *= rhs.inv();
    return *this;
  }

  ModInt &operator++(int n) {
    value++;
    if (value >= MOD) {
      value -= MOD;
    }
    return *this;
  }

  ModInt &operator--(int n) {
    if (value == 0) {
      value += MOD;
    }
    value--;
    return *this;
  }

  ModInt inv() { return ModInt::pow(*this, MOD - 2); }

  static ModInt pow(ModInt base, long long int n) {
    ModInt res = ModInt(1);
    while (n) {
      if (n & 1) {
        res *= base;
      }
      base *= base;
      n /= 2;
    }
    return res;
  }

  static ModInt comb(ModInt n, ModInt r) { return comb(n.value, r.value); }

  static ModInt comb(int n, int r) {
    if (n < r)
      return ModInt(0);
    ModInt res = ModInt(1);
    for (int i = 0; i < r; i++) {
      res *= ModInt(n - i);
    }

    ModInt inv = ModInt(1);
    for (int i = 0; i < r; i++) {
      inv *= ModInt(r - i);
    }
    return res / inv;
  }

  u64 getValue() const { return value; }

private:
  u64 value;

  friend std::ostream &operator<<(std::ostream &out, const ModInt<MOD> &m) {
    out << m.value;
    return out;
  }

  friend std::istream &operator>>(std::istream &in, ModInt &m) {
    uint_fast64_t i;
    in >> i;
    m = ModInt(i);
    return in;
  }
};

#endif
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>

using namespace std;

#line 3 "abc160_f.cpp"

using mint = ModInt<1000000007>;

mint factorial_table[200001];

void dfs0(int cur, int par, const vector<vi> &g, vector<int> &size) {
  if (size[cur] != -1)
    return;
  size[cur] = 1;
  for (const auto v : g[cur]) {
    if (v == par)
      continue;
    dfs0(v, cur, g, size);
    size[cur] += size[v];
  }
}

void dfs1(int cur, int par, const vector<vi> &g, vector<mint> &dp, vector<int> &size) {
  dp[cur] = factorial_table[size[cur] - 1];
  for (auto v : g[cur]) {
    if (v == par)
      continue;
    dfs1(v, cur, g, dp, size);
    dp[cur] *= dp[v];
    dp[cur] /= factorial_table[size[v]];
  }
}

void dfs2(int cur, int par, mint parV, const vector<vi> &g, const vector<mint> &dp, const vector<int> &size,
          vector<mint> &ans, int n) {
  if (par == -1) {
    ans[cur] = dp[cur];
  } else {
    ans[cur] = factorial_table[n - 1] * parV / factorial_table[n - size[cur]];
    for (auto v : g[cur]) {
      if (v == par)
        continue;
      ans[cur] *= dp[v];
      ans[cur] /= factorial_table[size[v]];
    }
  }

  // lCum, rCumの作成
  vector<mint> lCum, rCum;
  lCum.push_back(mint(1));
  REP(i, (int)g[cur].size()) {
    int v = g[cur][i];
    if (v == par)
      continue;
    lCum.push_back(dp[v] * lCum[lCum.size() - 1] / factorial_table[size[v]]);
  }

  rCum.push_back(mint(1));
  for (int i = (int)g[cur].size() - 1; i >= 0; i--) {
    int v = g[cur][i];
    if (v == par)
      continue;
    rCum.push_back(dp[v] * rCum[rCum.size() - 1] / factorial_table[size[v]]);
  }

  int li = 0;
  int ri = rCum.size() - 2;
  REP(i, (int)g[cur].size()) {
    int v = g[cur][i];
    if (v == par) {
      continue;
    }
    mint nParV = factorial_table[n - size[v] - 1] * lCum[li] * rCum[ri] * (parV / factorial_table[n - size[cur]]);
    li++;
    ri--;
    dfs2(v, cur, nParV, g, dp, size, ans, n);
  }
}

int main() {
  factorial_table[0] = mint(1);
  FOR(i, 1, 200001) { factorial_table[i] = factorial_table[i - 1] * mint(i); }

  int n;
  cin >> n;
  vector<vi> g(n);
  REP(i, n - 1) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  vi size(n, -1);
  vector<mint> dp(n, mint(1));
  vector<mint> ans(n, mint(1));
  dfs0(0, -1, g, size);
  dfs1(0, -1, g, dp, size);
  dfs2(0, -1, mint(1), g, dp, size, ans, n);

  REP(i, n) { cout << ans[i] << endl; }
}


Measured memory_bytes: 22128