#include <bits/stdc++.h>
using namespace std;
const int MAX = 1010;
const int MAX_X = 5050;
int N;
vector<int> child[MAX];
int X[MAX];
bool dp[MAX_X][2];
pair<int, int> dfs(int n) {
  int xn = X[n];
  if (child[n].size() == 0) return make_pair(0, xn);
  for (int i = 0; i < MAX_X; ++i) dp[i][0] = false;
  dp[0][0] = true;
  int S = 0;
  for (auto& v : child[n]) {
    pair<int, int> temp = dfs(v);
    int a = temp.first, b = temp.second;
    S += (a + b);
    for (int i = 0; i < MAX_X; ++i) dp[i][1] = false;
    for (int i = xn + 1 - 1; i >= 0; --i)
      if (dp[i][0]) {
        if (i + a <= xn) dp[i + a][1] = true;
        if (i + b <= xn) dp[i + b][1] = true;
      }
    for (int i = 0; i < MAX_X; ++i) dp[i][0] = dp[i][1];
  }
  int value = -1;
  for (int i = 0; i < xn + 1; ++i)
    if (dp[i][0]) value = i;
  if (value == -1) {
    cout << "IMPOSSIBLE" << endl;
    exit(0);
  }
  return make_pair(xn, S - value);
}
int main() {
  cin >> N;
  for (int i = 2; i < N + 1; ++i) {
    int p;
    cin >> p;
    child[p].push_back(i);
  }
  for (int i = 1; i < N + 1; ++i) cin >> X[i];
  dfs(1);
  cout << "POSSIBLE" << endl;
}
