s,i,a[17],*p=a;main(){for(;~scanf("%d",++p);i++)*p?s+=abs(~-*p/4-i/4)+abs(~-*p%4-i%4)+(~-*p!=i):0;for(;i=a[i]?:!puts(s?"No":"Yes");s-=2);}