#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000;
const int MAX = 10000;
int arr[MAXN];
vector<int> edges[MAXN];
int subtree[MAXN];
unordered_set<int> pos[MAXN];
void dfs(int i) {
  subtree[i] = 1;
  vector<pair<int, int>> vec;
  for (int j : edges[i]) {
    dfs(j);
    if (pos[j].empty()) return;
    subtree[i] += subtree[j];
  }
  sort(edges[i].begin(), edges[i].end(),
       [](int a, int b) { return pos[a].size() > pos[b].size(); });
  pos[i].insert(0);
  for (int j : edges[i]) {
    unordered_set<int> s;
    for (int a : pos[i])
      for (int b : pos[j]) s.insert(a + b);
    pos[i] = s;
  }
  unordered_set<int> s = pos[i];
  pos[i].clear();
  for (int x : s) {
    if (x / MAX <= arr[i]) pos[i].insert(arr[i] * MAX + x % MAX);
    if (x % MAX <= arr[i]) pos[i].insert(x - x % MAX + arr[i]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, i;
  int p;
  cin >> n;
  for (i = 1; i < n; ++i) {
    cin >> p;
    --p;
    edges[p].push_back(i);
  }
  for (i = 0; i < n; ++i) cin >> arr[i];
  dfs(0);
  cout << (pos[0].empty() ? "IMPOSSIBLE" : "POSSIBLE") << '\n';
}
