#include <bits/stdc++.h>
using namespace std;
int n;
int val[1002];
vector<int> v[1002];
int dp[1002][5002];
int white[1002];
int black[1002];
inline void dfs(int b) {
  dp[b][0] = 0;
  if (v[b].size() == 0) {
    white[b] = 0;
    black[b] = 0;
    return;
  }
  for (int k = 0; k < v[b].size(); k++) {
    int go = v[b][k];
    dfs(go);
    for (int j = 1002 - 1; j >= 0; j--) {
      if (dp[b][j] == INT_MAX) continue;
      int su = dp[b][j];
      dp[b][j] = INT_MAX;
      if (white[go] != INT_MAX && j + val[go] < 1002) {
        dp[b][j + val[go]] = min(dp[b][j + val[go]], su + white[go]);
      }
      if (black[go] != INT_MAX && j + black[go] < 1002) {
        dp[b][j + black[go]] = min(dp[b][j + black[go]], su + val[go]);
      }
    }
  }
  white[b] = black[b] = INT_MAX;
  for (int k = 0; k < 1002; k++) {
    if (dp[b][k] != INT_MAX) {
      if (dp[b][k] <= val[b]) {
        black[b] = min(black[b], k);
      }
    }
    if (k <= val[b]) {
      white[b] = min(white[b], dp[b][k]);
    }
  }
  if (black[b] == INT_MAX && white[b] == INT_MAX) {
    puts("IMPOSSIBLE");
    exit(0);
  }
}
int main() {
  for (int i = 0; i < 1002; i++) {
    for (int j = 0; j < 5002; j++) {
      dp[i][j] = INT_MAX;
    }
  }
  cin >> n;
  for (int i = 1; i < n; i++) {
    int p;
    scanf("%d", &p);
    p--;
    v[p].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &val[i]);
  }
  dfs(0);
  puts("POSSIBLE");
  return 0;
}
