Constraint for two dimensional array

In reply to Shashank Gurijala:

You understand the problem correctly.

i got it output as above code
array : ‘{’{1, 2, 3, 4, 5} , '{1, 2, 3, 4, 2} , '{1, 2, 5, 3, 2} , '{3, 5, 4, 3, 1} , '{5, 4, 3, 2, 1} }

Expected output:
1 2 3 4 5
1 2 3 5 2 ( At 2nd row 5 value is not generated, please check it from your side )
1 2 5 3 2
3 5 4 3 1
5 4 3 2 1