#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) {
  return ist >> right.first >> right.second;
}
template <class T, class U>
ostream& operator<<(ostream& ost, pair<T, U>& right) {
  return ost << right.first << ' ' << right.second;
}
template <class T, class TCompatible, size_t N>
void Fill(T (&dest)[N], const TCompatible& val) {
  fill(begin(dest), end(dest), val);
}
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T (&dest)[M][N], const TCompatible& val) {
  for (int i = 0; i < M; ++i) Fill(dest[i], val);
}
template <typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;
int N;
int P[1000];
vector<int> C[1000];
int X[1000];
pair<long long, long long> OPT[1000];
bool DP[1000][5001];
bool calced[1000];
bool rec(int i) {
  if (calced[i]) return true;
  DP[i][0] = 1;
  int base = 0;
  int total = 0;
  for (int j : C[i]) {
    if (!rec(j)) return false;
    int optmin = min(OPT[j].first, OPT[j].second);
    int optmax = max(OPT[j].first, OPT[j].second);
    base += optmin;
    total += optmax + optmin;
    int diff = optmax - optmin;
    for (int k = ((X[i] + 1) - 1); k >= (0); --k) {
      if (k - diff < 0) continue;
      DP[i][k] |= DP[i][k - diff];
    }
  }
  if (base > X[i]) return false;
  int submax = 0;
  for (int k = ((X[i] - base + 1) - 1); k >= (0); --k) {
    if (DP[i][k]) {
      submax = k;
      break;
    }
  }
  OPT[i] = pair<long long, long long>(X[i], total - submax);
  calced[i] = true;
  return true;
}
int main() {
  cin >> N;
  for (int i = (1); i < (int)(N); ++i) {
    cin >> P[i];
    --P[i];
    C[P[i]].push_back(i);
  }
  for (int i = (0); i < (int)(N); ++i) {
    cin >> X[i];
  }
  cout << (rec(0) ? "" : "IM") << "POSSIBLE" << endl;
  return 0;
}
