#include <bits/stdc++.h>
using namespace std;
int dp[2][5555];
vector<int> ko[1111];
int mok[1111];
int dfs(int node) {
  vector<int> v;
  for (int i = 0; i < ko[node].size(); i++) v.push_back(dfs(ko[node][i]));
  int cur = 0;
  for (int i = 0; i <= mok[node]; i++) dp[0][i] = 0, dp[1][i] = 1000000000;
  for (int i = 0; i < ko[node].size(); i++) {
    int z = v[i], y = mok[ko[node][i]];
    for (int j = 0; j <= mok[node]; j++) {
      if (j + y <= mok[node])
        dp[1 - cur][j + y] = min(dp[1 - cur][j + y], dp[cur][j] + z);
      if (j + z <= mok[node])
        dp[1 - cur][j + z] = min(dp[1 - cur][j + z], dp[cur][j] + y);
    }
    for (int j = 0; j <= mok[node]; j++) dp[cur][i] = 1000000000;
    cur = 1 - cur;
  }
  return dp[cur][mok[node]];
}
int main() {
  int num;
  scanf("%d", &num);
  for (int i = 1; i < num; i++) {
    int z;
    scanf("%d", &z);
    z--;
    ko[z].push_back(i);
  }
  for (int i = 0; i < num; i++) scanf("%d", &mok[i]);
  if (dfs(0) >= 1000000000)
    printf("IMPOSSIBLE\n");
  else
    printf("POSSIBLE\n");
}
