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)
	}
	facs := make([]mint, n+1)
	facs[0] = 1
	for i := 1; i <= n; i++ {
		facs[i] = facs[i-1].mul(mint(i))
	}
	invs := make([]mint, n+1)
	invs[n] = facs[n].inv()
	for i := n - 1; i >= 0; i-- {
		invs[i] = invs[i+1].mul(mint(i + 1))
	}

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

func dfs(c, p int, ee [][]edge, vv []int, dp, facs, invs []mint) {
	dp[c] = 1
	children := 0
	for _, e := range ee[c] {
		if e.to == p {
			continue
		}
		dfs(e.to, c, ee, vv, dp, facs, invs)
		dp[c] = dp[c].mul(invs[vv[e.to]]).mul(dp[e.to])
		children += vv[e.to]
	}
	dp[c] = dp[c].mul(facs[children])
	vv[c] = children + 1
}
func bfs(c, p, n int, ee [][]edge, vv []int, dp, facs, invs []mint) {
	for _, e := range ee[c] {
		if e.to == p {
			continue
		}
		r := dp[c].div(dp[e.to]).mul(facs[vv[e.to]]).mul(facs[n-1-vv[e.to]]).mul(invs[n-1])
		dp[e.to] = dp[e.to].mul(r).mul(invs[vv[e.to]-1]).mul(facs[n-1]).mul(invs[n-vv[e.to]])
		bfs(e.to, c, n, ee, vv, dp, facs, invs)
	}
}
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 < 32; 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())
}


Measured memory_bytes: 35584