Wasted 1 hour on understanding why my answer is wrong. The figure shown in the problem is definitely not correct and should be corrected.
Please refer to this attached figure to understand the problem better.
The point is that a move like 1->8 does not touch 4 and 5. This can be understood from this image.
Thanks @vijayks that helped