reconstruct the matrix using cross linkedlists