now correctly switches direction for corner cases; still prints nothing for cases 3->4 and 5->4
now handles 3->4 and 4->3 etc correctly