import java.util.*

fun main(args:Array<String>) {

    val mod = 1000000007L
    val n = readLine()!!.toInt()
    val dp = LongArray(n)
    val factorial = LongArray(n+1)
    val edges = Array(n){HashSet<Int>()}
    val s = Array(n){0}
    val visited = BooleanArray(n)

    factorial[0] = 1
    factorial[1] = 1

    for(i in 2 ..n) {
        factorial[i] = (factorial[i-1] * i) % mod
    }

    for(i in 0 until n - 1) {
        var (a,b) = readLine()!!.split(" ").map { it.toInt() }
        a--
        b--
        edges[a].add(b)
        edges[b].add(a)
    }

    fun modInv(a:Long, m:Long = mod): Long {
        // a^m-2
        fun mInv(a:Long, m:Long): Long {
            if(m == 0L) return 1L
            if(m == 1L) return a

            var result = mInv(a, m / 2) % mod
            if(result < 0) {
                println(".")
            }
            result = (result * result) % mod
            if(m % 2 != 0L) {
                result = (result * a) % mod
            }
            if(result > mod) {
                println(".")
            }
            return result
        }
        val ret = mInv(a, m - 2)
        return ret
    }

    fun dfs(cur:Int): Int {
        var cnt = 0
        visited[cur] = true
        for(adj in edges[cur]) {
            if(visited[adj]) continue
            cnt += dfs(adj)
        }
        visited[cur] = false
        s[cur] = cnt + 1
        dp[cur] = (factorial[s[cur] - 1])
        for(adj in edges[cur]) {
            if(visited[adj])  continue
            dp[cur] = (dp[cur] * dp[adj]) % mod
            dp[cur] = dp[cur] * modInv(factorial[s[adj]]) % mod
//            dp[cur] = (dp[cur] * dp[adj] / factorial[s[adj]]) % mod
//            dp[cur] %= mod
        }
        return s[cur]
    }

    fun dfs2(root:Int) {
        visited[root] = true
        for(child in edges[root]) {
            if(visited[child]) continue
            //dp[child] = dp[cur] * s[child] / factorial[ n - s[child] ]
//            dp[child] = dp[root] * s[child] / factorial [ n - s[child]]
            val v = (n - s[child]).toLong()
            dp[child] = (dp[root] * s[child]) % mod
            dp[child] = (dp[child] * modInv(v)) % mod
            /*
            if(dp[child] / v == 0L) {
                dp[child] = (dp[child] + mod) / v
                if(dp[child]==0L) {
                    while (true){
                    }
                }
            } else {
                dp[child] = dp[child] / v
            }
             */
            dp[child] %= mod
            dfs2(child)
        }
        visited[root] = false
    }
    dfs(0)
    dfs2(0)

    for(i in 0 until n) {
        println(dp[i])
    }
}