#include <bits/stdc++.h>
using namespace std;
bool dfs(int s, vector<vector<int>> child, vector<int> X,
         vector<vector<int>> &dp, vector<bool> visit) {
  int a, b, c, d, m, mm, M, MM;
  visit[s] = true;
  bool can;
  if (child[s].size() == 0) {
    dp[s][0] = X[s];
    return true;
  }
  for (int i = 0; i < child[s].size(); i++) {
    if (!visit[child[s][i]]) {
      can = dfs(child[s][i], child, X, dp, visit);
      if (!can) return false;
    }
  }
  for (int i = 0; i < child[s].size(); i++) {
    a = dp[s][0] + dp[child[s][i]][0];
    b = dp[s][1] + dp[child[s][i]][1];
    c = dp[s][0] + dp[child[s][i]][1];
    d = dp[s][1] + dp[child[s][i]][0];
    if (X[s] >= a && X[s] >= b) {
      dp[s][0] = a;
      dp[s][1] = b;
    } else {
      if (X[s] >= c && X[s] >= d) {
        dp[s][0] = c;
        dp[s][1] = d;
      } else {
        if (X[s] < a && X[s] < b && X[s] < c && X[s] < d) {
          return false;
        } else {
          M = max(a, b);
          m = min(a, b);
          MM = max(c, d);
          mm = min(c, d);
          if (M <= X[s] && MM <= X[s]) {
            if (m > mm) {
              dp[s][0] = m;
              dp[s][1] = max(a, b);
            } else {
              dp[s][0] = mm;
              dp[s][1] = max(c, d);
            }
          } else {
            if (M > X[s] && MM > X[s]) {
              if (m > mm) {
                if (X[s] >= m) {
                  dp[s][0] = m;
                  dp[s][1] = max(a, b);
                } else {
                  dp[s][0] = mm;
                  dp[s][1] = MM;
                }
              } else {
                if (X[s] >= mm) {
                  dp[s][0] = mm;
                  dp[s][1] = MM;
                } else {
                  dp[s][0] = m;
                  dp[s][1] = M;
                }
              }
            } else {
              if (M > MM) {
                dp[s][0] = MM;
                dp[s][1] = mm;
              } else {
                dp[s][0] = M;
                dp[s][1] = m;
              }
            }
          }
        }
      }
    }
  }
  m = max(dp[s][0], dp[s][1]);
  if (m > X[s]) {
    if (dp[s][0] > dp[s][1])
      dp[s][1] = X[s];
    else
      dp[s][0] = X[s];
  } else {
    if (dp[s][0] < dp[s][1])
      dp[s][1] = X[s];
    else
      dp[s][0] = X[s];
  }
  return true;
}
int main() {
  int N;
  cin >> N;
  vector<int> parent(N + 1, 0);
  vector<vector<int>> child(N);
  vector<bool> visit(N, false);
  vector<vector<int>> dp(N, vector<int>(2, 0));
  for (int i = 1; i < N; i++) {
    cin >> parent[i];
    child[parent[i] - 1].push_back(i);
  }
  vector<int> X(N);
  for (int i = 0; i < N; i++) cin >> X[i];
  if (dfs(0, child, X, dp, visit))
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
