long a[1<<18],j;main(i){for(;~scanf("%d",a-i--)?j=1:j-a[j]?i=a[j],a[j]=a[i],a[i]=i,~--*a:a[++j];);j=!puts(*a&1?"NO":"YES");}