#include <bits/stdc++.h>
using namespace std;
const int MaxX = 5000;
const int MaxN = 2000;
const long long LongInf = 1e18;
bool failed;
vector<long long> adj[MaxN];
long long w[MaxN];
int n, a;
pair<long long, long long> dfs(int u, int par) {
  if (adj[u].size() == 1 && adj[u][0] == par) return make_pair(w[u], 0);
  long long sub_w = 0;
  bool can[MaxX + 5];
  can[0] = true;
  for (auto v : adj[u]) {
    if (v == par) continue;
    pair<long long, long long> x = dfs(v, u);
    sub_w += x.first + x.second;
    for (int j = MaxX; j >= 0; j--) {
      if (can[j]) {
        can[j] = false;
        if (j + x.first <= 5000) can[x.first + j] = true;
        if (j + x.second <= 5000) can[x.second + j] = true;
      }
    }
  }
  for (int i = w[u]; i >= 0; i--)
    if (can[i]) return make_pair(w[u], sub_w - i);
  failed = true;
  return make_pair(LongInf, LongInf);
}
int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 2; i <= n; i++) {
    cin >> a;
    adj[i].push_back(a);
    adj[a].push_back(i);
  }
  for (int i = 1; i <= n; i++) cin >> w[i];
  dfs(1, -1);
  if (!failed)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
