swapping terminals