fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = MyScanner()
        val n = sc.nextInt()
        val edges = Array(n) { mutableListOf<Int>() }
        for (i in 0 until n - 1) {
            val a = sc.nextInt() - 1
            val b = sc.nextInt() - 1
            edges[a].add(b)
            edges[b].add(a)
        }
        val fact = Array(200001) { ModInt(1) }
        for (i in 1..200000) {
            fact[i] = fact[i - 1] * i
        }
        // 0　根　iが根の部分木　サイズ
        val size = Array(n) { -1 }
        val memo = Array(n) { ModInt(1) }

        fun dfs1(pos: Int, p: Int) {
            var s = 0
            for (i in edges[pos].indices) {
                val to = edges[pos][i]
                if (to == p) continue
                dfs1(to, pos)
                s += size[to]
                memo[pos] *= memo[to]
                memo[pos] *= fact[size[to]].inverse()
            }
            memo[pos] *= fact[s]
            size[pos] = s + 1
        }

        dfs1(0, -1)
        // println(memo.joinToString(" "))
        // println(size.joinToString(" "))
        val ans = Array(n) { ModInt(1) }


        fun dfs2(pos: Int, p: Int, pp: ModInt) {
            // println("$pos $p $pp")
            ans[pos] = memo[pos] * (fact[size[pos] - 1] * fact[n - size[pos]]).inverse() * pp * fact[n - 1]
            for (i in edges[pos].indices) {
                val to = edges[pos][i]
                if (to == p) continue
                val nextPP = ans[pos] * (fact[n - 1] * memo[to]).inverse() * fact[size[to]] * fact[n - size[to] - 1]
                dfs2(to, pos, nextPP)
            }
        }
        dfs2(0, -1, ModInt(1))
        println(ans.joinToString("\n"))
    }
}

class ModInt(_num: Number) : Number() {
    companion object {
        const val mod: Long = 1000000007L
    }

    private val num: Long = if (_num.toLong() < 0) (_num.toLong() % mod) + mod else _num.toLong() % mod
    operator fun plus(right: Number) = ModInt(num + (right.toLong() % mod))
    operator fun minus(right: Number) = ModInt(num - (right.toLong() % mod))
    operator fun times(right: Number) = ModInt(num * (right.toLong() % mod))

    // modが素数の時のみ
    operator fun div(right: Number) = this * ModInt(right).inverse()

    fun power(n: Number): ModInt {
        var a = this
        var result = ModInt(1)
        var tmp = n.toLong()
        while (tmp > 0) {
            if (tmp % 2 == 1L) {
                result *= a
            }
            tmp /= 2
            a *= a
        }
        return result
    }

    // modが素数のときのみ 逆元
    fun inverse(): ModInt {
        return power(mod - 2L)
    }

    override fun toString() = num.toString()
    override fun toInt() = num.toInt()
    override fun toLong() = num
    override fun toByte() = num.toByte()
    override fun toChar() = num.toChar()
    override fun toDouble() = num.toDouble()
    override fun toFloat() = num.toFloat()
    override fun toShort() = num.toShort()
}


class MyScanner() {
    private var index = 0
    private var line = listOf<String>()

    fun next(): String {
        while (line.size <= index) {
            line = readLine()!!.split(' ')
            index = 0
        }
        return line[index++]
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextDouble() = next().toDouble()
    fun nextCharArray() = next().toCharArray()
    fun nextChar() = next()[0]

    fun strList(): List<String> {
        index = line.size
        return readLine()!!.split(' ')
    }

    fun intList() = strList().map { it.toInt() }
    fun longList() = strList().map { it.toLong() }
    fun doubleList() = strList().map { it.toDouble() }
}

Measured memory_bytes: 176012