System-verilog constraint for 2D array, where value of an element should not match to any of its neighbors

In reply to dave_59:

Hi Dave

Thanks for the solution. Would you be able to fill-up rest of the conditions above ? I just want to cross verify.

Thanks in advance.