Implement the dancing link algorithm.