#include <bits/stdc++.h>
using namespace std;
std::mt19937 generator;
const int MAXN = 1111;
int p[MAXN];
int x[MAXN];
int m[MAXN][MAXN];
int col[MAXN];
int n;
bool dfs(int k, int c) {
  col[k] = c;
  for (int i = 0; i < n; i++) {
    if (!m[k][i]) {
      continue;
    }
    if (col[i] != -1) {
      if ((col[k] ^ col[i]) == 0) {
        return false;
      }
    } else {
      if (!dfs(i, 1 - c)) {
        return false;
      }
    }
  }
  return true;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  cin >> n;
  p[0] = -1;
  for (int i = 1; i < n; i++) {
    cin >> p[i];
    p[i]--;
  }
  for (int i = 0; i < n; i++) {
    cin >> x[i];
    col[i] = -1;
  }
  for (int i = 0; i < n; i++) {
    int cur = i;
    while (cur != -1) {
      if (x[cur] < x[i]) {
        m[cur][i] = 1;
        m[i][cur] = 1;
      }
      cur = p[cur];
    }
  }
  for (int i = 0; i < n; i++) {
    if (col[i] == -1) {
      if (!dfs(i, 0)) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
      }
    }
  }
  cout << "POSSIBLE" << endl;
  return 0;
}
