The clue that you have is that the apartment 2 is between 5 and 6. But they are consecutive, so there has to be an exchange of either 5 or 6 in one of the exchange. Let us say it is 5. If 5 is exchanged in first then the place of 5 would be far off 1,5,3,4,2,6,7,8, so 5 would have got changed in second shift. This means 2 was at 4 before second shift(1,_,3,2,5,6,7,8), meaning the first shift was with 4. (1,4,3,2,5,6,7,8)=>(1,4,3,5,2,6,7,8). But there could have a second case too. (1,7,3,4,5,6,2,8)=> (1,7,3,4,5,2,6,8), that is 7 & 6, BUT 7 is not there in the option.