#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 10;
const long double PI = acos(-1);
const long double EPS = 1e-9;
const long long MOD = 1e9 + 7;
const int M = 5e2 + 3;
const int N = 1e2 + 3;
int p[N], x[N];
vector<int> g[N];
int d[N][2];
int r[2][N][M];
void dfs(int v) {
  for (auto t : g[v]) dfs(t);
  if (g[v].size() == 0) {
    for (int i = 0; i < (int)2; i++) d[v][i] = INF;
    d[v][0] = 0;
    d[v][1] = 0;
    return;
  }
  for (int col = 0; col < (int)2; col++)
    for (int i = 0; i < (int)g[v].size() + 1; i++)
      fill(r[col][i], r[col][i] + M, INF);
  r[0][0][0] = r[1][0][0] = 0;
  for (int col = 0; col < (int)2; col++)
    for (int i = 0; i < (int)g[v].size(); i++) {
      int u = g[v][i];
      for (int j = 0; j < (int)M; j++)
        if (r[col][i][j] != INF) {
          if (j + x[u] < M)
            r[col][i + 1][j + x[u]] =
                min(r[col][i + 1][j + x[u]], r[col][i][j] + d[u][col]);
          if (j + d[u][!col] < M)
            r[col][i + 1][j + d[u][!col]] =
                min(r[col][i + 1][j + d[u][!col]], r[col][i][j] + x[u]);
        }
    }
  d[v][0] = INF;
  d[v][1] = INF;
  for (int i = 0; i < (int)x[v] + 1; i++) {
    d[v][0] = min(d[v][0], r[0][(int)g[v].size()][i]);
    d[v][1] = min(d[v][1], r[1][(int)g[v].size()][i]);
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < (int)n - 1; i++) {
    cin >> p[i + 1];
    g[p[i + 1] - 1].push_back(i + 1);
  }
  for (int i = 0; i < (int)n; i++) cin >> x[i];
  dfs(0);
  if (d[0][0] != INF || d[0][1] != INF)
    cout << "POSSIBLE";
  else
    cout << "IMPOSSIBLE";
}
