Create swapNodesInPairs