#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const int N = 1005;
int n, x[N], p[N], a[N], len[N], dp[5005], cl[2][5005];
vector<int> g[N];
void dfs(int v, int pr = -1) {
  for (int to : g[v]) {
    if (to == pr) continue;
    dfs(to, v);
    len[v] = max(len[v], len[to] + 1);
  }
  if (len[v] == 0) {
    a[v] = x[v];
  } else if (len[v] == 1) {
    int sum = 0;
    dp[0] = 1;
    for (int i = 1; i <= 5000; i++) dp[i] = 0;
    vector<int> vec;
    for (int to : g[v]) {
      if (to == pr) continue;
      vec.push_back(x[to]);
      sum += x[to];
    }
    for (int i : vec)
      for (int j = x[v]; j - i >= 0; j--)
        if (dp[j - i]) {
          dp[j] = 1;
          cl[0][v] = max(cl[0][v], j);
        }
    cl[0][v] = sum - cl[0][v];
    cl[1][v] = x[v];
  } else {
    for (int to : g[v]) {
      if (to == pr) continue;
      cl[0][v] += cl[0][to];
      cl[1][v] += cl[1][to];
    }
    if (x[v] < cl[0][v] && x[v] < cl[1][v]) {
      puts("IMPOSSIBLE");
      exit(0);
    }
    if (cl[0][v] > cl[1][v] && x[v] >= cl[0][v])
      cl[0][v] = x[v];
    else
      cl[1][v] = x[v];
  }
}
int main() {
  cin >> n;
  for (int i = 2; i <= n; i++) {
    cin >> p[i];
    g[i].push_back(p[i]);
    g[p[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) cin >> x[i];
  dfs(1);
  puts("POSSIBLE");
}
