const val INF = Int.MAX_VALUE / 4

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  if (n == 1) {
    println("POSSIBLE")
    return
  }

  val graph = Array(n, { mutableListOf<Int>() })
  val rawParents = readLine()!!.split(" ").map(String::toInt)
  rawParents.forEachIndexed { rawIndex, rawValue ->
    val index = rawIndex + 1
    val parent = rawValue - 1
    graph[parent].add(index)
  }
  val xs = readLine()!!.split(" ").map(String::toInt)

  val dp = IntArray(n, { INF })
  fun isValid(v: Int): Boolean {
    if (graph[v].size == 0) {
      dp[v] = 0
      return true
    }
    if (graph[v].any { !isValid(it) }) {
      return false
    }

    val innerDP = Array(graph[v].size + 1, { IntArray(xs[v] + 1, { INF }) })
    innerDP[0][0] = 0
    for (i in graph[v].indices) {
      val c = graph[v][i]
      val v1 = xs[c]
      val v2 = dp[c]
      for (k1 in 0..xs[v]) {
        if (innerDP[i][k1] < INF) {
          for (k2 in (k1 + v1)..xs[v]) {
            innerDP[i + 1][k2] = Math.min(innerDP[i + 1][k2], innerDP[i][k1] + v2)
          }
          for (k2 in (k1 + v2)..xs[v]) {
            innerDP[i + 1][k2] = Math.min(innerDP[i + 1][k2], innerDP[i][k1] + v1)
          }
        }
      }
    }
    if (innerDP[graph[v].size][xs[v]] == INF) return false
    dp[v] = innerDP[graph[v].size][xs[v]]
    return true
  }
  
  val ans = isValid(0)
  println(if (ans) "POSSIBLE" else "IMPOSSIBLE")
}
