local mod = 1000000007
local mfl = math.floor

local function bmul(x, y)
  local x0, y0 = x % 31623, y % 31623
  local x1, y1 = mfl(x / 31623), mfl(y / 31623)
  return (x1 * y1 * 14122 + (x1 * y0 + x0 * y1) * 31623 + x0 * y0) % mod
end

local function badd(x, y)
  return (x + y) % mod
end

local function bsub(x, y)
  return x < y and x - y + mod or x - y
end

local function modpow(src, pow)
  local res = 1
  while 0 < pow do
    if pow % 2 == 1 then
      res = bmul(res, src)
      pow = pow - 1
    end
    src = bmul(src, src)
    pow = mfl(pow / 2)
  end
  return res
end

local function modinv(src)
  return modpow(src, mod - 2)
end
local n = io.read("*n")

local fact = {1}
for i = 2, n do
  fact[i] = bmul(fact[i - 1], i)
end
local function getComb(n, k)
  if k == 0 or k == n then return 1 end
  return bmul(fact[n], modinv(bmul(fact[k], fact[n - k])))
end
local function getInvComb(n, k)
  if k == 0 or k == n then return 1 end
  return bmul(fact[k], bmul(fact[n - k], modinv(fact[n])))
end


local edge = {}
local parent = {}
local childcnt = {}
local child_asked_cnt = {}
for i = 1, n do
  edge[i] = {}
  parent[i] = 0
  childcnt[i] = 0
  child_asked_cnt[i] = 0
end
for i = 1, n - 1 do
  local a, b = io.read("*n", "*n")
  table.insert(edge[a], b)
  table.insert(edge[b], a)
end
local tasks = {1}
for itask = 1, n do
  local src = tasks[itask]
  for i = 1, #edge[src] do
    local dst = edge[src][i]
    if parent[src] ~= dst then
      parent[dst] = src
      table.insert(tasks, dst)
    end
  end
end
tasks = {}
-- find leaf
for i = 2, n do
  if #edge[i] == 1 then
    table.insert(tasks, i)
  end
end
for itask = 1, n - 1 do
  local child = tasks[itask]
  local p = parent[child]
  -- print(p, child)
  if 0 < p then
    childcnt[p] = childcnt[p] + 1 + childcnt[child]
    child_asked_cnt[p] = child_asked_cnt[p] + 1
    if child_asked_cnt[p] + 1 == #edge[p] then
      table.insert(tasks, p)
    end
  end
end
local allmult = 1
local multiple = {}
for i = 1, n do
  multiple[i] = 1
end
tasks = { {1, 1} }
for itask = 1, n do
  local src, mul = tasks[itask][1], tasks[itask][2]
  -- when start from parents
  multiple[src] = bmul(multiple[src], mul)
  local childall = childcnt[src]
  local otherall = n - 1
  local prog_mul = 1
  for i = 1, #edge[src] do
    local dst = edge[src][i]
    if parent[src] ~= dst then
      prog_mul = bmul(prog_mul, getComb(otherall, 1 + childcnt[dst]))
      otherall = otherall - 1 - childcnt[dst]
    end
  end
  -- when start from src
  multiple[src] = bmul(multiple[src], prog_mul)
  -- affect to parents
  local affect = bmul(prog_mul, getInvComb(n - 1, n - 1 - childcnt[src]))
  allmult = bmul(allmult, affect)
  -- print(src, prog_mul, allmult)
  local afinv = modinv(affect)
  mul = bmul(mul, afinv)
  multiple[src] = bmul(multiple[src], afinv)
  -- when start from children
  for i = 1, #edge[src] do
    local dst = edge[src][i]
    if parent[src] ~= dst then
      local prog = bmul(prog_mul, mul)
      prog = bmul(prog, getInvComb(n - 1, 1 + childcnt[dst]))
      table.insert(tasks, {dst, prog})
    end
  end
end
for i = 1, n do
  -- print(i, allmult, multiple[i])
  local z = bmul(allmult, multiple[i])
  print(z)
end


Measured memory_bytes: 45228