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