#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <bitset>
#include <stdlib.h>


const int kN = 1000 + 5;
std::vector<int> edges[kN];
int x[kN], y[kN];
int n;

void dfs(int u, int fa)
{
    int sum = 0;
    for (int v : edges[u]) if (v != fa) {
        dfs(v, u);
        sum += x[v] + y[v];
    }
    std::bitset<5000 + 1> mask;
    mask[0] = 1;
    for (int v : edges[u]) if (v != fa) {
        mask = mask << x[v] | mask << y[v];
    }
    bool flag = false;
    for (int i = x[u]; i >= 0; -- i) if (mask[i]) {
        sum += x[u] - i;
        flag = true;
        break;
    }
    if (!flag) {
        puts("IMPOSSIBLE");
        exit(0);
    }
    y[u] = sum - x[u];
}

int main()
{
    scanf("%d", &n);
    for (int i = 2; i <= n; ++ i) {
        int p;
        scanf("%d", &p);
        edges[p].emplace_back(i);
    }
    for (int i = 1; i <= n; ++ i)
        scanf("%d", x + i);
    dfs(1, 0);
    puts("POSSIBLE");
}
