#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline void setin(string s) { freopen(s.c_str(), "r", stdin); }
inline void setout(string s) { freopen(s.c_str(), "w", stdout); }
template <typename T>
inline T range(T l, T r) {
  return uniform_int_distribution<T>(l, r)(rng);
}
template <typename T>
void Min(T &a, T b) {
  a = min(a, b);
}
template <typename T>
void Max(T &a, T b) {
  a = max(a, b);
}
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int N = 5e3 + 15;
int n, a[N];
vector<int> g[N];
int dp[N][2];
int temp[2][N][2][N];
void dfs(int v) {
  vector<int> mn[2];
  for (int i = 0; i < 2; ++i) mn[i].resize(g[v].size(), inf);
  temp[1][v][0][0] = temp[1][v][1][0] = 0;
  int bit = 0;
  for (int i = 0; i < g[v].size(); ++i) {
    int to = g[v][i];
    dfs(to);
    bit = i & 1;
    for (int j = 0; j < 2; ++j) {
      if (dp[to][j] != inf) {
        int k = dp[to][j];
        for (int t = 0; t < N; ++t) {
          if (t + a[to] < N)
            Min(temp[bit][v][j][t + a[to]], temp[bit ^ 1][v][j][t] + k);
          if (t + k < N)
            Min(temp[bit][v][j ^ 1][t + k], temp[bit ^ 1][v][j][t] + a[to]);
        }
        break;
      }
    }
  }
  if (g[v].size() == 0)
    dp[v][0] = dp[v][1] = 0;
  else {
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j <= a[v]; ++j) Min(dp[v][i], temp[bit][v][i][j]);
  }
}
int main() {
  memset(temp, 0x3f, sizeof(temp));
  memset(dp, 0x3f, sizeof(dp));
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  cin >> n;
  for (int i = 2; i <= n; ++i) {
    int p;
    cin >> p;
    g[p].push_back(i);
  }
  for (int i = 1; i <= n; ++i) cin >> a[i];
  dfs(1);
  for (int i = 0; i < N; ++i)
    if (dp[1][0] != inf || dp[1][1] != inf)
      return cout << "POSSIBLE" << '\n', 0;
  cout << "IMPOSSIBLE" << '\n';
  return 0;
}
