#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int qq = 2e5 + 10;
const int INF = 1e9 + 10;
vector<int> G[qq];
int dp[qq][2];
int x[qq];
int color[2];
int weight[2];
void Dfs(int u, bool &f) {
  int sz = (int)G[u].size();
  if (sz == 0) return;
  dp[u][0] = dp[u][1] = -1;
  int a = 0, b = 0;
  for (int i = 0; i < sz; ++i) {
    int v = G[u][i];
    Dfs(v, f);
    if (dp[v][0] != -1) a += dp[v][0];
    if (dp[v][1] != -1) b += dp[v][1];
  }
  if (weight[1] == -1) {
    dp[u][1] = x[u];
    weight[1] = x[u];
  } else if (a + weight[0] == x[u]) {
    dp[u][0] = a + weight[0];
  } else if (b + weight[1] == x[u]) {
    dp[u][1] = b + weight[1];
  } else {
    f = false;
  }
  if (dp[u][0] == -1) {
    dp[u][0] = a;
  }
  if (dp[u][1] == -1) {
    dp[u][1] = b;
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 2; i <= n; ++i) {
    int v;
    scanf("%d", &v);
    G[v].push_back(i);
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", x + i);
  }
  weight[0] = weight[1] = -1;
  bool f = true;
  for (int i = 1; i <= n; ++i) {
    if (G[i].size() == 0) {
      if (weight[0] == -1) {
        weight[0] = x[i];
        dp[i][0] = x[i];
        dp[i][1] = -1;
      } else if (weight[1] == -1) {
        weight[1] = x[i];
        dp[i][0] = -1;
        dp[i][1] = x[i];
      } else {
        if (weight[0] == x[i]) {
          dp[i][0] = x[i];
          dp[i][1] = -1;
        } else if (weight[1] == x[i]) {
          dp[i][1] = x[i];
          dp[i][0] = -1;
        } else {
          f = false;
        }
      }
    }
  }
  if (!f) {
    puts("IMPOSSIBLE");
    return 0;
  }
  Dfs(1, f);
  if (f)
    puts("POSSIBLE");
  else
    puts("IMPOSSIBLE");
  return 0;
}
