Matt loves letter L.A point set P is (a, b)-L if and only if there exists x, y satisfying:P = {(x, y), (x + 1, y), . . . , (x + a, y), (x, y + 1), . . . , (x, y + b)}(a, b ≥ 1)A point set Q is good if and only if Q is an (a, b)-L set and gcd(a, b) =…