Bug-hunting marriage algorithm