#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
int IT_MAX = 1 << 19;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
const int MX = 4005;
const int MM = 998244353;
vector<int> T[MX];
int D[MX];
int N, a;
pair<int, int> dfs(int x) {
  vector<pair<int, int> > L;
  for (int c : T[x]) {
    L.push_back(dfs(c));
  }
  static int arr[2][MX], *S = arr[0], *E = arr[1];
  memset(S, 0x3f, sizeof arr[0]);
  S[0] = 0;
  for (pair<int, int> c : L) {
    memset(E, 0x3f, sizeof arr[0]);
    for (int i = c.first; i < MX; i++) {
      E[i] = min(S[i - c.first] + c.second, E[i]);
    }
    for (int i = c.second; i < MX; i++) {
      E[i] = min(S[i - c.second] + c.first, E[i]);
    }
    swap(S, E);
  }
  for (int i = 0; i < MX; i++) {
    if (S[i] <= D[x]) return pair<int, int>(D[x], i);
  }
  printf("IMPOSSIBLE\n");
  exit(0);
}
int main() {
  scanf("%d", &N);
  for (int i = 2; i <= N; i++) {
    scanf("%d", &a);
    T[a].push_back(i);
  }
  for (int i = 1; i <= N; i++) scanf("%d", D + i);
  dfs(1);
  printf("POSSIBLE\n");
}
