#include <bits/stdc++.h>
using namespace std;
int const Max_N = 3e3 + 50;
vector<int> Head[Max_N];
int w[Max_N];
int x[Max_N];
int d[Max_N];
void CreatEdge(int u, int v) {
  d[v]++;
  Head[v].push_back(u);
  Head[u].push_back(v);
}
bool vis[Max_N];
int n;
set<int> st1, st2;
bool bfs() {
  queue<int> que;
  for (int i = 1; i < (n + 1); ++i)
    if (d[i] == 0) que.push(i);
  memset(vis, 0, sizeof(vis));
  ;
  while (!que.empty()) {
    int u = que.front();
    que.pop();
    vis[u] = true;
    st1.clear();
    st2.clear();
    for (int i = 0; i < (Head[u].size()); ++i) {
      int v = Head[u][i];
      if (v < u) {
        d[v]--;
        if (d[v] == 0) que.push(v);
        continue;
      }
      if (st2.empty()) {
        st2.insert(w[v] - x[v]);
        st2.insert(x[v]);
        continue;
      }
      for (auto it = st1.begin(); it != st1.end(); ++it) {
        int a = *it + w[v] - x[v];
        int b = *it + x[v];
        st2.insert(a);
        st2.insert(b);
      }
    }
    if (st2.size() == 0) continue;
    auto it = st2.begin();
    st1 = st2;
    if (*it > x[u]) return false;
  }
  return true;
}
int dfs(int u, int fa) {
  w[u] = x[u];
  for (int i = 0; i < Head[u].size(); ++i) {
    int v = Head[u][i];
    if (v == fa) continue;
    w[u] += dfs(v, u);
  }
  return w[u];
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i < (n + 1); ++i) {
    int v;
    scanf("%d", &v);
    CreatEdge(i, v);
  }
  for (int i = 1; i < (n + 1); ++i) scanf("%d", x + i);
  dfs(1, -1);
  if (bfs())
    printf("POSSIBLE\n");
  else
    printf("IMPOSSIBLE\n");
  return 0;
}
