Algorithm 1
Input: H ∈ ℕ m , V ∈ ℕ n
W.l.o.g assume: ∀ i : h i ∈ [ 1 , n ] , ∀ j : v j ∈ [ 1 , m ] , ∑ i h i = ∑ j v j and m ≤ n .
For k , l = 1 , ⋯ , m do begin
If F k , l ( H , V ) is satisfiable,
then output P = A ∪ B ∪ C ∪ D ¯ and halt.
end
output “failure”.