module IntMap = Map.Make (struct
  type t = int
  let compare = compare
end)

let () = Scanf.scanf "%d\n" @@ fun n ->
  let es = Array.make n [] in
  if n = 1 then
    ignore (read_line ())
  else
    for i = 1 to n - 1 do
      Scanf.scanf "%d " @@ fun p ->
        es.(p - 1) <- i :: es.(p - 1)
    done;
  let xs = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun x -> x in
  let rec solve v =
    let xys = List.map (fun u -> xs.(u), solve u) es.(v) in
    let most = List.fold_right (fun (x, y) -> ( + ) @@ max x y) xys 0 in
    let least = List.fold_right (fun (x, y) -> ( + ) @@ min x y) xys 0 in
    if xs.(v) < least then raise Not_found
    else IntMap.fold (fun _ -> min)
      (List.fold_left (fun m (w, v_) ->
        let le, _, _ = IntMap.split (xs.(v) - least - w + 1) m in
        IntMap.fold (fun w' v' m ->
          IntMap.add (w + w')
            (max (v_ + v') @@
              try IntMap.find (w + w') m
              with Not_found -> min_int) m) le m) (IntMap.singleton 0 most) @@
        List.map (fun (x, y) -> abs (x - y), ~- (abs (x - y))) xys) max_int in
  print_endline @@
  try ignore (solve 0); "POSSIBLE"
  with Not_found -> "IMPOSSIBLE"

