#include <bits/stdc++.h>
using namespace std;
template <typename T>
struct Edge {
  int to;
  T cost;
};
struct Graph {
  int n;
  vector<vector<int>> g;
  Graph(int n) : n(n) { g.resize(n); }
  void init(int n_) {
    n = n_;
    g.resize(n_);
  }
  void add_edge(int from, int to) { g[from].push_back(to); }
};
int main() {
  int n;
  cin >> n;
  int x[1002];
  Graph g(n);
  for (int i = 1; i < n; i++) {
    int p;
    cin >> p;
    p--;
    g.add_edge(p, i);
  }
  for (int i = 0; i < n; i++) cin >> x[i];
  int l[1002], h[1002];
  for (int i = 0; i < n; i++) l[i] = -1;
  for (int i = n - 1; i >= 0; i--) {
    int k = 0;
    for (int c : g.g[i]) k += l[c] + h[c];
    bool dp[5003]{0};
    dp[0] = true;
    for (int c : g.g[i]) {
      for (int j = 5000; j >= 0; j--) {
        if (!dp[j]) continue;
        if (j + l[c] <= 5000) dp[j + l[c]] = true;
        if (j + h[c] <= 5000) dp[j + h[c]] = true;
      }
    }
    for (int j = 0; j <= 5000; j++) {
      if (dp[j] && k - j <= x[i]) {
        if (j <= x[i])
          l[i] = j, h[i] = x[i];
        else
          l[i] = x[i], h[i] = j;
        break;
      }
    }
    if (l[i] == -1) {
      cout << "IMPOSSIBLE" << endl;
      return 0;
    }
  }
  cout << "POSSIBLE" << endl;
}
