#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
inline void chmin(int &x, int y) {
  if (x > y) x = y;
}
int N;
int dp[1010];
int p[1010];
vector<int> g[1010];
int x[1010];
int dp2[2][5010];
int main() {
  cin >> N;
  for (int i = 0; i < (N); i++) dp[i] = INF;
  for (int i = 0; i < (N - 1); i++) {
    cin >> p[i + 1];
    --p[i + 1];
    g[p[i + 1]].push_back(i + 1);
  }
  for (int i = 0; i < (N); i++) cin >> x[i];
  for (int i = N - 1; i >= 0; --i) {
    if (g[i].size() == 0) {
      dp[i] = 0;
    } else {
      for (int j = 0; j < (5010); j++) dp2[0][j] = dp2[1][j] = INF;
      int c = 0, f = 1;
      int to0 = g[i][0];
      dp2[c][x[to0]] = dp[to0];
      if (dp[to0] < 5010) {
        chmin(dp2[c][dp[to0]], x[to0]);
      }
      for (int j = 1; j < g[i].size(); ++j) {
        int to = g[i][j];
        for (int k = 0; k < (5010); k++) dp2[f][k] = INF;
        for (int k = 0; k < (5010); k++)
          if (dp2[c][k] < 5010) {
            int u = k + x[to], v = dp2[c][k] + dp[to];
            if (u > v) swap(u, v);
            if (u < 5010) {
              chmin(dp2[f][u], v);
            }
            u = k + dp[to], v = dp2[c][k] + x[to];
            if (u > v) swap(u, v);
            if (u < 5010) {
              chmin(dp2[f][u], v);
            }
          }
        swap(c, f);
      }
      for (int k = 0; k < (5010); k++) {
        if (k <= x[i]) {
          chmin(dp[i], dp2[c][k]);
        }
        if (dp2[c][k] <= x[i]) {
          chmin(dp[i], k);
        }
      }
    }
  }
  puts(dp[0] != INF ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}
