#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> tree[1010];
int color[1010];
int X[1010];
int weight[1010];
int weightSumWhite[1010];
int weightSumBlack[1010];
stack<int> st;
queue<int> bfs;
void Debug() {
  while (!st.empty()) {
    printf("%d ", st.top());
    st.pop();
  }
  printf("\n");
}
int dp[1010][5010];
int main() {
  memset(color, 0, sizeof(color));
  memset(X, 0, sizeof(X));
  memset(weight, 0, sizeof(weight));
  memset(weightSumWhite, 0, sizeof(weightSumWhite));
  memset(weightSumBlack, 0, sizeof(weightSumBlack));
  cin >> N;
  for (int i = 1; i < N; ++i) {
    int tmp;
    cin >> tmp;
    tmp--;
    tree[tmp].push_back(i);
  }
  for (int i = 0; i < N; ++i) {
    cin >> X[i];
  }
  bfs.push(0);
  while (!bfs.empty()) {
    int v = bfs.front();
    bfs.pop();
    st.push(v);
    for (int i = 0; i < tree[v].size(); ++i) {
      bfs.push(tree[v][i]);
    }
  }
  while (!st.empty()) {
    int v = st.top();
    st.pop();
    if (tree[v].size() == 0) {
      weight[v] = X[v];
      if (X[v] == 0) {
        color[v] = 1;
      }
    } else {
      int sumWhite = 0;
      int sumBlack = 0;
      int sumLeaf = 0;
      vector<int> leaf;
      for (int i = 0; i < tree[v].size(); ++i) {
        int child = tree[v][i];
        sumWhite += weightSumWhite[child];
        sumBlack += weightSumBlack[child];
        if (color[child] == 0) {
          leaf.push_back(child);
          sumLeaf += weight[child];
        }
      }
      if (sumWhite > X[v] && sumBlack > X[v]) {
        printf("IMPOSSIBLE\n");
        return 0;
      }
      if (sumWhite == X[v]) {
        weight[v] = 0;
        color[v] = 1;
        weightSumWhite[v] = sumWhite;
        weightSumBlack[v] = sumBlack + sumLeaf;
        continue;
      }
      if (sumBlack == X[v]) {
        weight[v] = 0;
        color[v] = 2;
        weightSumWhite[v] = sumWhite + sumLeaf;
        weightSumBlack[v] = sumBlack;
        continue;
      }
      if (leaf.size() == 0) {
        if ((sumWhite > sumBlack && sumWhite < X[v]) ||
            (sumBlack > sumWhite && sumBlack > X[v])) {
          weight[v] = X[v] - sumWhite;
          color[v] = 1;
          weightSumWhite[v] = X[v];
          weightSumBlack[v] = sumBlack;
        } else {
          weight[v] = X[v] - sumBlack;
          color[v] = 2;
          weightSumWhite[v] = sumWhite;
          weightSumBlack[v] = X[v];
        }
        continue;
      }
      int candWhite, candBlack;
      for (int k = 0; k < 2; ++k) {
        int base;
        if (k == 0) {
          base = X[v] - sumWhite;
        } else {
          base = X[v] - sumBlack;
        }
        memset(dp, 0, sizeof(dp));
        for (int i = 0; i < leaf.size() + 1; ++i) {
          dp[i][base] = base;
        }
        for (int j = 0; j < base + 1; ++j) {
          dp[leaf.size() - 1][j] = j;
          dp[leaf.size()][j] = j;
        }
        for (int i = leaf.size() - 1; i >= 0; --i) {
          for (int j = 0; j < base; ++j) {
            int cand1;
            if (j + weight[i] > base) {
              cand1 = -1;
            } else {
              cand1 = dp[i + 1][j + weight[i]];
            }
            int cand2 = dp[i + 1][j];
            if (cand1 >= 0 && base - cand1 < base - cand2) {
              dp[i][j] = cand1;
            } else if (cand2 >= 0) {
              dp[i][j] = cand2;
            }
          }
        }
        if (k == 0) {
          candWhite = dp[0][0];
        } else {
          candBlack = dp[0][0];
        }
      }
      if (X[v] - sumWhite - candWhite < X[v] - sumBlack - candBlack) {
        weight[v] = X[v] - sumWhite - candWhite;
        color[v] = 1;
        weightSumWhite[v] = X[v];
        weightSumBlack[v] = sumBlack + (sumLeaf - candWhite);
      } else {
        weight[v] = X[v] - sumBlack - candBlack;
        color[v] = 2;
        weightSumWhite[v] = sumWhite + (sumLeaf - candBlack);
        weightSumBlack[v] = X[v];
      }
    }
  }
  printf("POSSIBLE\n");
  return 0;
}
