swap nodes in pairs