#include <bits/stdc++.h>
using namespace std;
int dx[8] = {0, 0, -1, 1, 1, 1, -1, -1};
int dy[8] = {-1, 1, 0, 0, 1, -1, 1, -1};
const int SIZE = 1050;
vector<int> child[SIZE];
vector<int> X;
int DP[SIZE] = {};
bool flag = 0;
int dp(int idx) {
  if (DP[idx] != -1) return DP[idx];
  if (child[idx].empty()) {
    DP[idx] = 0;
    return 0;
  }
  int DQ[2][5050] = {};
  for (int i = 0; i < 2; i++)
    for (int j = 0; j <= X[idx]; j++) DQ[i][j] = 0x3f3f3f3f;
  DQ[1][0] = 0;
  for (int i = 0; i < child[idx].size(); i++) {
    int c = child[idx][i];
    for (int j = 0; j <= X[idx]; j++) DQ[i % 2][j] = 0x3f3f3f3f;
    for (int j = 0; j <= X[idx]; j++) {
      if (j + X[c] <= X[idx])
        DQ[i % 2][j + X[c]] =
            min(DQ[i % 2][j + X[c]], DQ[(i + 1) % 2][j] + dp(c));
      if (j + dp(c) <= X[idx])
        DQ[i % 2][j + dp(c)] =
            min(DQ[i % 2][j + dp(c)], DQ[(i + 1) % 2][j] + X[c]);
    }
  }
  int ret = 0x3f3f3f3f;
  for (int i = 0; i <= X[idx]; i++)
    ret = min(ret, DQ[(child[idx].size() + 1) % 2][i]);
  DP[idx] = ret;
  if (ret == 0x3f3f3f3f) flag = 1;
  return ret;
}
int main() {
  int N;
  cin >> N;
  for (int i = 1; i < N; i++) {
    int p;
    cin >> p;
    p--;
    child[p].push_back(i);
  }
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    X.push_back(x);
  }
  for (int i = 0; i < SIZE; i++) DP[i] = -1;
  dp(0);
  if (flag)
    cout << "IMPOSSIBLE" << endl;
  else
    cout << "POSSIBLE" << endl;
  return 0;
}
