Constraint for 2D Array so that no two adjacent elements are same

Write a constraint for a NXN 2D Array such that no two adjacent elements are same. Also, the difference between adjacent elements should be between +4 and -4. For a 2D array, you have to take care of adjacent element between consecutive rows and columns as well.