#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1234;
const int INF = 5678;
vector<int> G[MAXN];
int dp[2][MAXN], tmp[2][MAXN], X[MAXN], ans[MAXN];
bool visit[MAXN];
bool dfs(int cur) {
  visit[cur] = 1;
  memset(dp, 0, sizeof(dp));
  dp[0][0] = dp[1][0] = 1;
  int sum = 0;
  for (auto chd : G[cur]) {
    if (!visit[chd]) {
      if (!dfs(chd)) return false;
      memset(tmp, 0, sizeof(tmp));
      for (int i = 0; i < INF; i++)
        if (i >= X[chd] && (dp[0][i - X[chd]] || dp[1][i - X[chd]]))
          tmp[0][i] = 1;
      for (int i = 0; i < INF; i++)
        if (i >= ans[chd] && (dp[0][i - ans[chd]] || dp[1][i - ans[chd]]))
          tmp[1][i] = 1;
      for (int i = 0; i < 2; i++)
        for (int j = 0; j < INF; j++) dp[i][j] = tmp[i][j];
      sum += (X[chd] + ans[chd]);
    }
  }
  int MAX[2] = {-1, -1};
  for (int i = 0; i < 2; i++)
    for (int j = X[cur]; j >= 0; j--) {
      if (dp[i][j]) {
        MAX[i] = j;
        break;
      }
    }
  if (MAX[0] == -1 && MAX[1] == -1) return false;
  ans[cur] = sum - max(MAX[0], MAX[1]);
  return true;
}
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 2; i <= N; i++) {
    int par;
    scanf("%d", &par);
    G[par].push_back(i);
  }
  for (int i = 1; i <= N; i++) scanf("%d", &X[i]);
  if (!dfs(1))
    puts("IMPOSSIBLE");
  else
    puts("POSSIBLE");
  return 0;
}
