two-way partition

with debug in region-mapping