#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const int MAX_X = 5050;
const int MAX_N = 1010;
vector<vector<int>> edge(MAX_N);
vector<int> xs;
pair<int, int> dfs(int n) {
  int total = xs[n];
  if ((int)edge[n].size() == 0) {
    return pair<int, int>{0, total};
  }
  vector<int> dp(MAX_X, 0);
  int child_sum = 0;
  for (int i = 0; i < (int)edge[n].size(); i++) {
    pair<int, int> ret = dfs(edge[n][i]);
    if (ret.first == -1) {
      return pair<int, int>{-1, -1};
    }
    child_sum += ret.first + ret.second;
    if (i == 0) {
      if (ret.first <= 5000) {
        dp[ret.first] = 1;
      }
      if (ret.second <= 5000) {
        dp[ret.second] = 1;
      }
      continue;
    }
    for (int j = 5000; j > -1; j--) {
      if (dp[j] == 1 && j + ret.second <= 5000) {
        dp[j + ret.second] = 1;
      }
      if (dp[j] == 1 && j + ret.first <= 5000) {
        dp[j + ret.first] = 1;
      }
    }
  }
  for (int i = total; i > -1; i--) {
    if (dp[i] == 1) {
      int a = child_sum - i;
      int b = total;
      if (a > b) {
        swap(a, b);
      }
      return pair<int, int>{a, b};
    }
  }
  return pair<int, int>{-1, -1};
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int p;
    cin >> p;
    p--;
    edge[p].push_back(i + 1);
  }
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    xs.push_back(x);
  }
  pair<int, int> ret = dfs(0);
  if (ret.first == -1) {
    cout << "IMPOSSIBLE" << endl;
  } else {
    cout << "POSSIBLE" << endl;
  }
  return 0;
}
