#include <bits/stdc++.h>
using namespace std;
const int MAXDP = 5003;
int N;
vector<vector<int> > children;
int X[1003];
int x[1003][2];
int dp[2][MAXDP + 1];
bool dfs(int u) {
  if (children[u].size() == 0) {
    x[u][0] = X[u];
    return true;
  }
  fill(dp[0], dp[2], 0);
  dp[0][0] = 1;
  int sum = 0;
  for (int i = 0; i < children[u].size(); i++) {
    int v = children[u][i];
    if (not dfs(v)) return false;
    for (int j = 0; j < MAXDP; j++) {
      if (j - x[v][0] >= 0) dp[(i + 1) & 1][j] |= dp[i & 1][j - x[v][0]];
      if (j - x[v][1] >= 0) dp[(i + 1) & 1][j] |= dp[i & 1][j - x[v][1]];
    }
    sum += x[v][0] + x[v][1];
    fill(dp[i & 1], dp[i & 1 + 1], 0);
  }
  cerr << u << endl;
  if (dp[(int)children[u].size() & 1][X[u]] > 0) {
    x[u][0] = X[u];
    x[u][1] = sum - X[u];
    return true;
  }
  return false;
}
int main() {
  cin >> N;
  children.resize(N, vector<int>());
  for (int i = 1; i < N; i++) {
    int p;
    cin >> p;
    --p;
    children[p].push_back(i);
  }
  for (int i = 0; i < N; i++) {
    cin >> X[i];
    cerr << "i:" << i << endl;
    cerr << "children is" << endl;
    for (auto v : children[i]) cerr << v << endl;
  }
  bool ok = dfs(0);
  cerr << ok << endl;
  if (ok)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
