#include <bits/stdc++.h>
using namespace std;
void read(int& x) { scanf("%d", &x); }
void read(long long& x) { scanf("%lld", &x); }
template <typename T, typename... Args>
void read(T& a, Args&... b) {
  read(a);
  read(b...);
}
int n;
vector<int> c[1010];
int first[1010];
int d[1010];
const int inf = 1e9;
char dp[5000010];
void dfs(int v) {
  int cs = 0;
  dp[cs] = 1;
  int ms = 0;
  int as = 0;
  for (int i : c[v]) {
    dfs(i);
    int D = d[i], X = first[i], M = max(D, X);
    as += D + X;
    for (int j = 1; j <= M; ++j) dp[cs + j] = 0;
    for (int j = cs; ms <= j; --j)
      if (dp[j]) {
        dp[j] = 0;
        dp[j + D] = 1;
        dp[j + X] = 1;
      }
    ms += min(D, X);
  }
  if (first[v] < ms) {
    puts("IMPOSSIBLE");
    exit(0);
  }
  for (int i = first[v]; ms <= i; --i)
    if (dp[i]) {
      d[v] = as - i;
      break;
    }
}
int main() {
  read(n);
  for (int first, i = 2; i <= n; ++i) {
    read(first);
    c[first].push_back(i);
  }
  for (int i = 1; i <= n; ++i) read(first[i]);
  dfs(1);
  puts("POSSIBLE");
  return 0;
}
