/* Problem 4--Sliding Number
   Once you get the blank into the lower right corner, all you need do
   is count the inversions in the 15 tiles.  An even number means the
   problem is solvable; an odd number means it isn't. */

import java.io.*;
import java.util.*;

public class prob4 {

 public static Scanner in=null;
 public static PrintWriter out=null;

 public static void main (String[] args) throws Exception {

  in = new Scanner (new File ("prob4.in"));
  out = new PrintWriter ("prob4.out");
  String n="";
  int cs=1;
  while (!(n=in.nextLine()).equals("")) {
   out.print ("Case "+(cs++)+": ");
   int pos = n.indexOf (' ');
   char[] chars = n.toCharArray();
   for (; pos%4 < 3; pos++) chars[pos] = chars[pos+1]; //move blank rt
   for (; pos < 15; pos+=4) chars[pos] = chars[pos+4]; //move blank dn
   int inv=0;
   for (int i=0; i < 14; i++)
    for (int j=i+1; j < 15; j++)
     if (chars[i] > chars[j]) inv++; //ct inversions
   if (inv%2==0) out.println ("YES");
   else out.println ("NO");
  }
  in.close();
  out.close();
 }
}
