#include <bits/stdc++.h>
using namespace std;
struct Tree {
  long long index;
  long long a, b;
  vector<Tree*> childlen;
};
long long N;
Tree tree[1000];
long long X[1000];
long long dp[1000][5001];
void dfs(Tree& tree) {
  if (tree.childlen.empty()) {
    tree.a = X[tree.index];
    tree.b = 0;
    return;
  }
  for (Tree* c : tree.childlen) {
    dfs(*c);
  }
  long long x = X[tree.index];
  for (long long i = 0; i < tree.childlen.size(); i++) {
    for (long long j = 0; j <= x; j++) {
      dp[i][j] = INT_MAX;
    }
  }
  dp[0][tree.childlen[0]->a] = tree.childlen[0]->b;
  dp[0][tree.childlen[0]->b] = tree.childlen[0]->a;
  for (long long i = 0; i < tree.childlen.size() - 1; i++) {
    Tree* child = tree.childlen[i + 1];
    for (long long j = 0; j <= x; j++) {
      if (dp[i][j] < INT_MAX) {
        if (j + child->a <= x) {
          dp[i + 1][j + child->a] =
              (((dp[i + 1][j + child->a]) < (dp[i][j] + child->b))
                   ? (dp[i + 1][j + child->a])
                   : (dp[i][j] + child->b));
        }
        if (j + child->b <= x) {
          dp[i + 1][j + child->b] =
              (((dp[i + 1][j + child->b]) < (dp[i][j] + child->a))
                   ? (dp[i + 1][j + child->b])
                   : (dp[i][j] + child->a));
        }
      }
    }
  }
  long long min = INT_MAX;
  for (long long i = 0; i <= x; i++) {
    min = (((min) < (dp[tree.childlen.size() - 1][i]))
               ? (min)
               : (dp[tree.childlen.size() - 1][i]));
  }
  if (min == INT_MAX) {
    cout << "IMPOSSIBLE" << endl;
    exit(0);
  }
  tree.a = x;
  tree.b = min;
}
signed main() {
  cin >> N;
  for (long long(i) = 0; (i) < (N - 1); (i)++) {
    long long p;
    cin >> p;
    tree[p - 1].childlen.push_back(&tree[i + 1]);
    tree[i + 1].index = i + 1;
  }
  for (long long(i) = 0; (i) < (N); (i)++) cin >> X[i];
  dfs(tree[0]);
  cout << "POSSIBLE" << endl;
}
