Assume the square in the upper-left corner is white.
By the condition in statement, a set {a,b} in P is a horizontal domino if ∣a−b∣=1 and a vertical domino if ∣a−b∣=506, with the possible exceptions {506,507}, {1012,1013} and {1518,1519}. As this latter is an all-black member of P and dominoes are bicolour, P must have some all-white member. The only such is {1012,1013}.
Hence, to form a set in P, the number 506 pairs off with exactly one of 505 and 507.
As {506,507} is all-black and there are no more all-white sets left, 506 must pair off with 505, as stated.