Solution for swap case.