package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}
func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0
	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 3
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}
	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	ee = make([][]edge, n)
	for i := 0; i < n-1; i++ {
		a := getNextInt(scanner) - 1
		b := getNextInt(scanner) - 1
		appendEdge(a, b, i, ee)
		appendEdge(b, a, i, ee)
	}

	dp = make([]mint, n)
	vv = make([]int, n)
	mc = newModcom(n)
	dfs(0, -1)
	bfs(0, -1, n)
	for i := 0; i < n; i++ {
		fmt.Fprintln(writer, dp[i])
	}
}

var (
	dp []mint
	vv []int
	mc modcom
	ee [][]edge
)

func dfs(c, p int) {
	dp[c] = 1
	for _, e := range ee[c] {
		if e.to == p {
			continue
		}
		dfs(e.to, c)
		vv[c] += vv[e.to]
		dp[c] = dp[c].mul(mc.calc(vv[c], vv[e.to])).mul(dp[e.to])
	}
	vv[c]++
}
func bfs(c, p, n int) {
	for _, e := range ee[c] {
		if e.to == p {
			continue
		}
		r := dp[c].div(dp[e.to]).mul(mc.rcalc(n-1, vv[e.to]))
		dp[e.to] = dp[e.to].mul(r).mul(mc.calc(n-1, n-vv[e.to]))
		bfs(e.to, c, n)
	}
}
func appendEdge(from, to, id int, ee [][]edge) {
	ee[from] = append(ee[from], edge{
		to: to,
		id: id,
	})
}

type edge struct {
	to, id int
}

type mint int64

func (mt mint) mod() mint {
	m := mint(1e9 + 7)
	return (mt%m + m) % m
}
func (mt mint) inv() mint {
	var m, y mint
	m = m.sub(2)
	dbl := mt
	y = 1
	for i := 0; i < 31; i++ {
		if m%2 == 1 {
			y = y.mul(dbl)
		}
		m >>= 1
		dbl = dbl.mul(dbl)
	}
	return y
}
func (mt mint) add(x mint) mint {
	return (mt + x).mod()
}
func (mt mint) sub(x mint) mint {
	return (mt - x).mod()
}
func (mt mint) mul(x mint) mint {
	return (mt * x).mod()
}
func (mt mint) div(x mint) mint {
	return mt.mul(x.inv())
}

type modcom struct {
	facs, invs []mint
}

func newModcom(n int) modcom {
	facs := make([]mint, n+1)
	invs := make([]mint, n+1)
	facs[0] = 1
	for i := 0; i < n; i++ {
		facs[i+1] = facs[i].mul(mint(i + 1))
	}
	invs[n] = facs[n].inv()
	for i := n - 1; i >= 0; i-- {
		invs[i] = invs[i+1].mul(mint(i + 1))
	}
	return modcom{
		facs: facs,
		invs: invs,
	}
}
func (mc *modcom) calc(n, k int) mint {
	return mc.facs[n].mul(mc.invs[k]).mul(mc.invs[n-k])
}
func (mc *modcom) rcalc(n, k int) mint {
	return mc.invs[n].mul(mc.facs[k]).mul(mc.facs[n-k])
}


Measured memory_bytes: 26752