#include <bits/stdc++.h>
using namespace std;
int n;
int tmp;
int dp[1000][5001];
struct node {
  struct node* child;
  struct node* next;
  int x;
  int y;
};
int sum(struct node* p, int x, int depth) {
  int ans = 10000, ans_tmp;
  if (p == NULL) {
    ans = 0;
  } else {
    if (x >= p->x) {
      if (dp[depth][x - p->x] == -1)
        dp[depth][x - p->x] = sum(p->next, x - p->x, depth + 1);
      ans = dp[depth][x - p->x] + p->y;
    }
    if (x >= p->y) {
      if (dp[depth][x - p->y] == -1)
        dp[depth][x - p->y] = sum(p->next, x - p->y, depth + 1);
      ans_tmp = dp[depth][x - p->y] + p->x;
      if (ans_tmp < ans) ans = ans_tmp;
    }
  }
  return ans;
}
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 j = 0; j < n; j++)
      for (int k = 5000; k >= 0; k--) dp[j][k] = -1;
    p[i]->y = sum(p[i]->child, p[i]->x, 0);
    if (p[i]->y >= 10000) {
      printf("IMPOSSIBLE\n");
      return 0;
    }
  }
  printf("POSSIBLE\n");
  return 0;
}
