#include <bits/stdc++.h>
using namespace std;
const int N = 1000 + 5, U = 5000 + 5;
int fa[N], x1[N], x2[N];
vector<int> lk[N];
int dp[U];
int main() {
  int n;
  cin >> n;
  for (int i = 2; i <= n; ++i) {
    cin >> fa[i];
    lk[fa[i]].push_back(i);
  }
  for (int i = 1; i <= n; ++i) cin >> x1[i];
  for (int x = n; x >= 1; --x) {
    int u = x1[x];
    for (int i = 0; i <= u; ++i) dp[i] = 0;
    for (auto y : lk[x]) {
      int a = x1[y], b = x2[y];
      if (a < b) swap(a, b);
      for (int i = u; i >= a; --i) dp[i] = min(dp[i - a] + b, dp[i - b] + a);
      for (int i = a - 1; i >= b; --i) dp[i] = dp[i - b] + a;
      for (int i = b - 1; i >= 0; --i) dp[i] = U;
    }
    if (dp[u] >= U) {
      puts("IMPOSSIBLE");
      exit(0);
    }
    x2[x] = dp[u];
  }
  puts("POSSIBLE");
}
