Algorithm 2

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 .

For min ( W ) , min ( E ) = 1 , , m and

min ( N ) , min ( S ) = 1 , , n do begin

If γ 2 L , G e o 1 1,1 ( H , V ) or γ 2 L , G e o 2 1,1 ( H , V ) or γ 2 L , G e o 3 1,1 ( H , V ) or γ 2 L , G e o 4 1,1 ( H , V ) is satisfiable,

then output P = A B C D ¯ and halt.

end

output “failure”.