package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatVec(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}
func AbsInt(x int) int {
  if x < 0 { x = -x }
  return x
}

func Factorial(N int) (F, Finv, Inv []int) {
  F = make([]int, N + 1)
  Finv = make([]int, N + 1)
  Inv = make([]int, N + 1)
  F[0] = 1
  F[1] = 1
  Finv[0] = 1
  Finv[1] = 1
  Inv[0] = 1
  Inv[1] = 1
  for i := 2; i < N + 1; i++ {
    F[i] = F[i - 1] * i % p
    Inv[i] = p - Inv[p % i] * (p / i) % p
    Finv[i] = Finv[i - 1] * Inv[i] % p
  }
  return
}

func Inverse(Inv *map[int]int, N int) int {
  _, ok := (*Inv)[N]
  if !ok {
    (*Inv)[N] = p - Inverse(Inv, p % N) * (p / N) % p
  }
  return (*Inv)[N]
}

func Comb(F, Finv *[]int, A ...int) int {
  S := SumInt(A...)
  C := (*F)[S]
  for _, a := range A {
    C *= (*Finv)[a]
    C %= p
  }
  return C
}
func RComb(F, Finv *[]int, A ...int) int {
  S := SumInt(A...)
  C := (*Finv)[S]
  for _, a := range A {
    C *= (*F)[a]
    C %= p
  }
  return C
}

const p = 1000000007

func Solve(){
  var N int
  NextInt(&N)
  T := make([][]int, N)
  for i := range T {
    T[i] = make([]int, 0)
  }
  var a, b int
  for i := 1; i < N; i++ {
    NextInt(&a, &b)
    a, b = a - 1, b - 1
    T[a] = append(T[a], b)
    T[b] = append(T[b], a)
  }
  Q := make([]int, N)
  P := make([]int, N)
  for i := range P {
    P[i] = -1
  }
  pos := 1
  for _, q := range Q {
    for _, adj := range T[q] {
      if P[q] == adj { continue }
      P[adj] = q
      Q[pos] = adj
      pos++
    }
  }
  F, Finv, _ := Factorial(N)
  R := make([]int, N)
  for i := range R {
    R[i] = 1
  }
  B := make([][]int, N)
  C := make([][][]int, N)
  for i := range C {
    C[i] = make([][]int, 0)
  }
  for i := N - 1; 0 <= i; i-- {
    q := Q[i]
    node := 1
    B[q] = make([]int, 0)
    for _, c := range C[q] {
      node += c[1]
      B[q] = append(B[q], c[1])
      R[q] *= R[c[0]]
      R[q] %= p
    }
    R[q] *= Comb(&F, &Finv, B[q]...)
    R[q] %= p
    if P[q] < 0 { continue }
    C[P[q]] = append(C[P[q]], []int{q, node})
  }
  Inv := make(map[int]int)
  Inv[0] = 1
  Inv[1] = 1
  for _, q := range Q {
    for _, c := range C[q] {
      r := (R[q] * Comb(&Finv, &F, N - c[1] - 1, c[1]) % p) * Inverse(&Inv, R[c[0]]) % p
      R[c[0]] *= r * Comb(&F, &Finv, N - c[1], c[1] - 1) % p
      R[c[0]] %= p
    }
  }
  for _, ans := range R {
    Write(ans)
  }
}

func main() {
  Solve()
  Output()
}

Measured memory_bytes: 51072