import choco.Problem;
import choco.ContradictionException;
import choco.integer.*;
import choco.Constraint;
import choco.Solver;
import choco.Solution;

public class Cases {

  
  public static void main(String[] args) {
     Problem pb = new Problem();

     IntDomainVar [] x = pb.makeEnumIntVarArray("x",27,0,2);
     IntDomainVar [] y = pb.makeEnumIntVarArray("y",27,0,2);
     IntDomainVar [] z = pb.makeEnumIntVarArray("z",27,0,2);
     IntDomainVar [] d = pb.makeEnumIntVarArray("d",27,0,1);
     IntDomainVar tot  = pb.makeEnumIntVar("tot",0,27);

     int h = 0;

     for(int i=0;i<3;i++)
	 for (int j=0;j<3;j++)
	     for(int k=0;k<3;k++){
		 Constraint Cxy, Cxz, Cyz;
		 if (i==0) Cxy = pb.gt(x[h],y[h]);
		 else if (i==1) Cxy = pb.eq(x[h],y[h]);
		 else Cxy = pb.lt(x[h],y[h]);

		 if (j==0) Cxz = pb.gt(x[h],z[h]);
		 else if (j==1) Cxz = pb.eq(x[h],z[h]);
		 else Cxz = pb.lt(x[h],z[h]);

		 if (k==0) Cyz = pb.gt(y[h],z[h]);
		 else if (k==1) Cyz = pb.eq(y[h],z[h]);
		 else Cyz = pb.lt(y[h],z[h]);

		 System.out.println(h);

		 Constraint C1 = pb.and(Cxy,Cxz,Cyz);
		 Constraint C2 = pb.eq(d[h],0);
		 Constraint C3 = pb.ifOnlyIf(C1,C2);
		 pb.post(C3);
		 
		 h++;
	     }

     pb.post(pb.eq(tot,pb.sum(d)));
     pb.minimize(tot,false);

     /*		
     Solver s = pb.getSolver();
     pb.solve(false);
     System.out.println("feasible: " + pb.isFeasible());
     System.out.println("nbSol: " + s.getNbSolutions());
     */

     for(int i=0;i<27;i++)
	 if (d[i].getVal() == 0)
	     System.out.println(x[i].getVal() + " " + y[i].getVal() + " " + z[i].getVal() + "   case " + i);
  }
}
