I think this needs some special kind of space filling curve to solve this, if it's even possible at all.