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) {
          if (k1 + v1 <= xs[v]) {
            innerDP[i + 1][k1 + v1] = Math.min(innerDP[i + 1][k1 + v1], innerDP[i][k1] + v2)
          }
          if (k1 + v2 <= xs[v]) {
            innerDP[i + 1][k1 + v2] = Math.min(innerDP[i + 1][k1 + v2], innerDP[i][k1] + v1)
          }
        }
      }
    }
    val min = innerDP[graph[v].size].min()!!
    if (min == INF) return false
    dp[v] = min
    return true
  }

  val ans = isValid(0)
  println(if (ans) "POSSIBLE" else "IMPOSSIBLE")
}
