#include <algorithm>
#include <bitset>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  int N;
  while (cin >> N) {
    vector<vector<int>> G(N);
    for (int i = 1; i < N; i++) {
      int p;
      cin >> p;
      --p;
      G[p].push_back(i);
    }
    vector<int> X(N);
    for (int i = 0; i < N; i++) {
      cin >> X[i];
    }
    function<int(int)> solve = [&](int v) {
      int sum = 0;
      bitset<5010> dp;
      dp.set(0);
      for (int u : G[v]) {
        int x0 = X[u];
        int x1 = solve(u);
        if (x1 < 0) {
          return -1;
        }
        sum += x0 + x1;
        dp = (dp << x0) | (dp << x1);
      }
      for (int x = X[v]; x >= 0; x--) {
        if (dp[x]) {
          return sum - x;
        }
      }
      return -1;
    };
    cout << (solve(0) < 0 ? "IMPOSSIBLE" : "POSSIBLE") << endl;
  }
  return 0;
}
