#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using iii = pair<int, ii>;
template <class T>
using vv = vector<vector<T>>;
template <class T, size_t M, size_t N>
class graph_delegate_t {
  T (&f)[M][N];

 public:
  graph_delegate_t(T (&f)[M][N]) : f(f) {}
  T& operator[](const ii& s) { return f[s.first][s.second]; }
  const T& operator[](const ii& s) const { return f[s.first][s.second]; }
};
ii operator+(const ii& lhs, const ii& rhs) {
  return make_pair(lhs.first + rhs.first, lhs.second + rhs.second);
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& t) {
  os << "{";
  for (int i = 0; i < int(t.size() - 1); ++i) {
    os << t[i] << ",";
  }
  if (!t.empty()) os << t.back();
  os << "}";
  return os;
}
template <class S, class T>
ostream& operator<<(ostream& os, const pair<S, T>& t) {
  return os << "(" << t.first << "," << t.second << ")";
}
vector<string> __macro_split(const string& s) {
  vector<string> v;
  int d = 0, f = 0;
  string t;
  for (char c : s) {
    if (!d && c == ',')
      v.push_back(t), t = "";
    else
      t += c;
    if (c == '\"' || c == '\'') f ^= 1;
    if (!f && c == '(') ++d;
    if (!f && c == ')') --d;
  }
  v.push_back(t);
  return v;
}
void __args_output(vector<string>::iterator, vector<string>::iterator) {
  cerr << endl;
}
template <typename T, typename... Args>
void __args_output(vector<string>::iterator it, vector<string>::iterator end,
                   T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << " = " << a;
  if (++it != end) {
    cerr << ", ";
  }
  __args_output(it, end, args...);
}
const int MAX_N = 1000 + 5;
int par[MAX_N];
int first[MAX_N];
int second[MAX_N];
vector<int> childs[MAX_N];
int val[MAX_N], val_o[MAX_N];
int sum[MAX_N][2];
bool dfs(int s, int b) {
  if (childs[s].empty()) {
    sum[s][b] = first[s];
    return true;
  }
  for (auto t : childs[s]) {
    if (!dfs(t, 1 - b)) {
      return false;
    }
  }
  int ctotal = 0, total = 0;
  for (auto t : childs[s]) {
    ctotal += min(sum[t][0], sum[t][1]);
    total += sum[t][0] + sum[t][1];
  }
  if (ctotal > first[s]) {
    return false;
  }
  vector<int> diff(childs[s].size());
  for (auto t : childs[s]) {
    diff.push_back(abs(sum[t][0] - sum[t][1]));
  }
  sort(diff.begin(), diff.end());
  for (auto df : diff) {
    if (ctotal + df <= first[s])
      ctotal += df;
    else
      break;
  }
  sum[s][b] = first[s];
  sum[s][1 - b] = total - ctotal;
  return true;
}
int main() {
  int n;
  cin >> n;
  par[1] = -1;
  for (int i = int(2); i <= int(n); ++i) cin >> par[i];
  for (int i = int(1); i <= int(n); ++i) cin >> first[i];
  for (int i = int(2); i <= int(n); ++i) {
    childs[par[i]].push_back(i);
  }
  if (!dfs(1, 0))
    cout << "IMPOSSIBLE" << endl;
  else
    cout << "POSSIBLE" << endl;
  return 0;
}
