#include <bits/stdc++.h>
using std::cin;
using std::cout;
const int maxn = 1200;
const int mod = 998244353;
inline long long pow(long long a, int b, int ans = 1) {
  for (; b; b >>= 1, a = a * a % mod)
    if (b & 1) ans = ans * a % mod;
  return ans;
}
inline long long inverse(int x) { return pow(x, mod - 2); }
int n;
int h[maxn], nxt[maxn];
int s[maxn];
inline void link(int f, int x) { nxt[x] = h[f], h[f] = x; }
int dp[maxn];
inline void down(int& x, int y) {
  if (x > y) x = y;
}
inline void dfs0(int x) {
  for (int i = h[x]; i; i = nxt[i]) {
    dfs0(i);
  }
  static int g0[10100], g1[100100];
  for (int i = (1), iend = (s[x]); i <= iend; ++i) g0[i] = 1e9;
  g0[0] = 0;
  for (int i = h[x]; i; i = nxt[i]) {
    for (int i = (0), iend = (s[x]); i <= iend; ++i) g1[i] = g0[i], g0[i] = 1e9;
    for (int j = (0), jend = (s[x]); j <= jend; ++j) {
      down(g0[j + dp[i]], g1[j] + s[i]);
      down(g0[j + s[i]], g1[j] + dp[i]);
    }
  }
  dp[x] = 1e9;
  for (int i = (0), iend = (s[x]); i <= iend; ++i) down(dp[x], g0[i]);
  if (dp[x] > 1e8) {
    cout << "IMPOSSIBLE" << '\n';
    exit(0);
  }
}
int main() {
  std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = (2), iend = (n); i <= iend; ++i) {
    int f;
    cin >> f;
    link(f, i);
  }
  for (int i = (1), iend = (n); i <= iend; ++i) {
    cin >> s[i];
  }
  dfs0(1);
  cout << "POSSIBLE" << '\n';
}
