#include <bits/stdc++.h>
using namespace std;
int n;
int tmp;
int dp[5001];
const int INF = 10000;
struct node {
  struct node* child;
  struct node* next;
  int x;
  int y;
};
void sum(struct node* p, int x) {
  int tmp;
  if (!p->next) {
    dp[p->x] = p->y;
    if (dp[p->y] > p->x) dp[p->y] = p->x;
  } else {
    sum(p->next, x);
    for (int i = x; i >= 0; i--) {
      if (dp[i] != INF) {
        tmp = dp[i];
        dp[i] = INF;
        if (i + p->x <= x && dp[i + p->x] > tmp + p->y)
          dp[i + p->x] = tmp + p->y;
        if (i + p->y <= x && dp[i + p->y] > tmp + p->x)
          dp[i + p->y] = tmp + p->x;
      }
    }
  }
}
int main(void) {
  struct node* p[1001];
  struct node* p_tmp;
  scanf("%d", &n);
  for (int i = 0; i <= n; i++) p[i] = new struct node;
  p[1]->child = NULL;
  p[1]->next = NULL;
  for (int i = 2; i <= n; i++) {
    scanf("%d", &tmp);
    if (p[tmp]->child == NULL)
      p[tmp]->child = p[i];
    else {
      p_tmp = p[tmp]->child;
      while (p_tmp->next != NULL) p_tmp = p_tmp->next;
      p_tmp->next = p[i];
    }
    p[i]->next = NULL;
    p[i]->child = NULL;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p[i]->x);
  }
  for (int i = n; i > 0; i--) {
    for (int k = p[i]->x; k >= 0; k--) dp[k] = INF;
    if (!p[i]->child) {
      p[i]->y = 0;
      continue;
    }
    sum(p[i]->child, p[i]->x);
    p[i]->y = INF;
    for (int k = p[i]->x; k >= 0; k--)
      if (dp[k] != INF && dp[k] < p[i]->y) p[i]->y = dp[k];
    if (p[i]->y == INF) {
      printf("IMPOSSIBLE\n");
      return 0;
    }
  }
  printf("POSSIBLE\n");
  return 0;
}
