#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f3f3f3f3f3f3fll;
const int MAX = 1e5 + 5;
const int MAX_N = MAX;
const long long MOD = 1e9 + 7;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template <typename T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
template <class T>
inline void read(T& num) {
  bool start = false, neg = false;
  char c;
  num = 0;
  while ((c = getchar()) != EOF) {
    if (c == '-')
      start = neg = true;
    else if (c >= '0' && c <= '9') {
      start = true;
      num = num * 10 + c - '0';
    } else if (start)
      break;
  }
  if (neg) num = -num;
}
inline long long powMM(long long a, long long b, long long M) {
  long long ret = 1;
  a %= M;
  while (b) {
    if (b & 1) ret = ret * a % M;
    b >>= 1;
    a = a * a % M;
  }
  return ret;
}
void open() { freopen("out.txt", "w", stdout); }
vector<vector<int> > edge;
vector<int> lim;
int n, tem;
int check(int now) {
  if (edge[now].size() == 0) return 0;
  int da = lim[now];
  vector<int> dp(n + 1, 1 << 30);
  dp[0] = 0;
  for (int x : edge[now]) {
    int a = lim[x];
    int num = check(x);
    if (num < 0) return -1;
    vector<int> dp2(n + 1, 1 << 30);
    for (int i = 0; i + a <= n; i++) dp2[i + a] = min(dp2[i + a], dp[i] + num);
    for (int i = 0; i + num <= n; i++)
      dp2[i + num] = min(dp2[i + num], dp[i] + a);
    dp.swap(dp2);
  }
  int r = *min_element(dp.begin(), dp.end());
  if (r == (1 << 30)) return -1;
  return r;
}
int main() {
  scanf("%d", &n);
  edge.resize(n + 1);
  lim.resize(n + 1);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &tem);
    edge[tem].push_back(i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &lim[i]);
  int an = check(1);
  if (an < 0)
    printf("IMPOSSIBLE\n");
  else
    printf("POSSIBLE\n");
  return 0;
}
