#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1005;
vector<int> G[MAX_N];
int memo[1005][5001][2];
vector<int> v;
int dfs(int u, int val, int p, int kind) {
  if (memo[u][val][kind] >= 0) {
    return memo[u][val][kind];
  }
  if ((int)G[u].size() == 1 && G[u][0] == p) {
    if (val == v[u]) {
      memo[u][val][kind] = 1;
      return 1;
    } else {
      memo[u][val][kind] = 0;
      return 0;
    }
  }
  memo[u][val][kind] = 0;
  for (int i = 0; i < (int)G[u].size(); ++i) {
    if (G[u][i] != p) {
      if (val - v[u] >= 0 && dfs(G[u][i], val - v[u], u, kind) == 1) {
        memo[u][val][kind] = 1;
        break;
      }
    }
  }
  for (int i = 0; i < (int)G[u].size(); ++i) {
    if (G[u][i] != p) {
      if (dfs(G[u][i], val, u, kind ^ 1) == 1) {
        memo[u][val][kind] = 1;
        break;
      }
    }
  }
  return memo[u][val][kind];
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < (int)n - 1; ++i) {
    int a;
    cin >> a;
    a--;
    G[i + 1].push_back(a), G[a].push_back(i + 1);
  }
  v.resize(n);
  for (int i = 0; i < (int)n; ++i) {
    cin >> v[i];
  }
  if (n == 1 && v[0] == 0) {
    cout << "POSSIBLE\n";
    return 0;
  }
  for (int i = 0; i < (int)n; ++i) {
    for (int j = 0; j < (int)5001; ++j) {
      for (int k = 0; k < (int)2; ++k) {
        memo[i][j][k] = -1;
      }
    }
  }
  bool ans = false;
  for (int i = v[0]; i <= 5000; i++) {
    if (dfs(0, i, -1, 0) == 1) {
      ans = true;
      break;
    }
  }
  if (ans) {
    cout << "POSSIBLE\n";
  } else {
    cout << "IMPOSSIBLE\n";
  }
  return 0;
}
