chapter4: swap