#include <bits/stdc++.h>
using namespace std;
const int maxx = 1e3 + 100;
const int MOD = 1e9;
struct node {
  int to, nextt;
} e[maxx];
int n;
int p[maxx];
int x[maxx];
int head[maxx];
int dp[maxx];
int f[maxx];
int cnt = 0;
void add(int u, int v) {
  e[cnt].to = v;
  e[cnt].nextt = head[u];
  head[u] = cnt++;
}
void dfs(int u) {
  for (int i = head[u]; ~i; i = e[i].nextt) {
    dfs(e[i].to);
  }
  dp[0] = 0;
  for (int i = head[u]; ~i; i = e[i].nextt) {
    int v = e[i].to;
    for (int j = x[u]; j >= 0; j--) {
      int temp = 0x3f3f3f3f;
      if (j >= x[v]) temp = min(temp, dp[j - x[v]] + f[v]);
      if (j >= f[v]) temp = min(temp, dp[j - f[v]] + x[v]);
      dp[j] = temp;
    }
  }
  for (int i = 0; i <= x[u]; i++) {
    f[u] = min(f[u], dp[i]);
  }
}
int main() {
  scanf("%d", &n);
  memset(head, -1, sizeof(head));
  for (int i = 2; i <= n; i++) {
    scanf("%d", &p[i]);
    add(p[i], i);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x[i]);
  }
  memset(f, 0x3f3f3f3f, sizeof(f));
  dfs(1);
  if (f[1] < 0x3f3f3f3f)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
