import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n = I()
    p = LI_()
    x = LI()
    e = collections.defaultdict(list)
    for i in range(n-1):
        e[p[i]].append(i+1)
        e[i+1].append(p[i])

    def f(i,k):
        a = 0
        xi = x[i]
        tx = xi
        for c in e[i]:
            if c == k:
                continue
            rc = f(c,i)
            if not rc:
                return
            tx += rc[1]
            a += rc[0]
        if a <= xi:
            return [min(tx-xi, xi), tx]
        return

    if f(0,-1):
        return 'POSSIBLE'

    return 'IMPOSSIBLE'


print(main())



