#include <bits/stdc++.h>
using namespace std;
using i64 = long long int;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;
int parent[1005];
vector<int> child[1005];
int table[1005];
int table2[1005][5005];
int value[1005];
int dp2(vector<ii>& arr, int idx, int remain) {
  if (remain < 0) return 987654321;
  if (idx == arr.size()) return 0;
  if (table2[idx][remain] != -1) return table2[idx][remain];
  int& res = table2[idx][remain];
  res = min(arr[idx].first + dp2(arr, idx + 1, remain - arr[idx].second),
            arr[idx].second + dp2(arr, idx + 1, remain - arr[idx].first));
  return res;
}
int dp1(int root) {
  if (child[root].empty()) return 0;
  if (table[root] != -1) return 0;
  int& res = table[root];
  vector<ii> arr;
  for (int i = 0; i < child[root].size(); i++) {
    memset(table2[i], -1, sizeof(table2[i]));
    arr.emplace_back(value[child[root][i]], dp1(child[root][i]));
  }
  res = dp2(arr, 0, value[root]);
  return res;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &parent[i]);
    child[parent[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &value[i]);
  memset(table, -1, sizeof(table));
  if (dp1(1) >= 987654321)
    printf("IMPOSSIBLE\n");
  else
    printf("POSSIBLE\n");
  return 0;
}
