#include <bits/stdc++.h>
using namespace std;
const int N = 5010;
struct Edge {
  int to, next;
} edge[N];
int head[N], num, c[N];
void add_edge(int a, int b) { edge[++num] = (Edge){b, head[a]}, head[a] = num; }
int fb[N], fw[N], tfb[N], tfw[N];
void dfs(int x) {
  for (int i = head[x]; i; i = edge[i].next) dfs(edge[i].to);
  for (int i = 1; i <= c[x]; i++) tfb[i] = tfb[i] = 1e9;
  tfb[0] = tfw[0] = 0;
  for (int i = head[x]; i; i = edge[i].next) {
    for (int j = c[x]; j >= 0; j--) {
      int tmpb = 1e9, tmpw = 1e9;
      if (j >= c[edge[i].to])
        tmpb = tfb[j - c[edge[i].to]] + fb[edge[i].to],
        tmpw = tfw[j - c[edge[i].to]] + fw[edge[i].to];
      if (j >= fw[edge[i].to]) {
        tmpb = min(tmpb, tfb[j - fw[edge[i].to]] + c[edge[i].to]);
      }
      if (j >= fb[edge[i].to]) {
        tmpw = min(tmpw, tfw[j - fb[edge[i].to]] + c[edge[i].to]);
      }
      tfb[j] = tmpb, tfw[j] = tmpw;
    }
  }
  fw[x] = fb[x] = 1e9;
  for (int i = 0; i <= c[x]; i++)
    fw[x] = min(fw[x], tfw[i]), fb[x] = min(fb[x], tfb[i]);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; i++) {
    int a;
    scanf("%d", &a);
    add_edge(a, i + 1);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
  dfs(1);
  if (fw[1] < 1e9 || fb[1] < 1e9)
    printf("POSSIBLE\n");
  else
    printf("IMPOSSIBLE\n");
  return 0;
}
