#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int pars[N + 1];
  int nc[N + 1];
  vector<vector<int>> child;
  pars[1] = 0;
  for (int i = 0; i <= N; i++) {
    vector<int> b;
    child.push_back(b);
    nc[i] = 0;
  }
  for (int i = 2; i <= N; i++) {
    cin >> pars[i];
    child[pars[i]].push_back(i);
    nc[pars[i]]++;
  }
  int X[N + 1];
  for (int j = 1; j <= N; j++) {
    cin >> X[j];
  }
  queue<int> q;
  int others[N + 1];
  for (int i = 1; i <= N; i++) {
    if (nc[i] == 0) q.push(i);
    others[i] = 0;
  }
  bool ans = true;
  while (!q.empty()) {
    int num = q.front();
    q.pop();
    nc[pars[num]]--;
    if (nc[pars[num]] == 0) q.push(pars[num]);
    others[num] = 0;
    vector<int> swaps;
    int csum = 0;
    for (int i = 0; i < child[num].size(); i++) {
      int v = child[num][i];
      int o1 = min(X[v], others[v]);
      int o2 = max(X[v], others[v]);
      csum += o1;
      others[num] += o2;
      swaps.push_back(o2 - o1);
    }
    if (csum > X[num]) ans = false;
    bool reach[X[num] + 1];
    for (int i = 0; i <= X[num]; i++) {
      reach[i] = false;
    }
    reach[csum] = true;
    for (int i = 0; i < swaps.size(); i++) {
      int cur = swaps[i];
      for (int j = X[num]; j >= csum; j--) {
        if (j - cur >= csum && reach[j - cur]) {
          reach[j] = true;
        }
      }
    }
    for (int j = X[num]; j >= csum; j--) {
      if (reach[j]) {
        others[num] -= j - csum;
        break;
      }
    }
  }
  if (ans)
    cout << "POSSIBLE\n";
  else
    cout << "IMPOSSIBLE\n";
  cin >> ans;
}
