Let's consider infinite Cartesian system of coordinates. Assume that in any lattice point (i.e. both coordinates are integers) there is a spike. I have a line segment of length $n$ (it is an integer). It is parallel to X axis, as shown below (image shows only a part of system of coordinates).
[![enter image description here](https://i.stack.imgur.com/JkwLg.png)](https://i.stack.imgur.com/JkwLg.png)

I want to make it parallel to Y axis as shown below.

[![enter image description here](https://i.stack.imgur.com/xRwdi.png)](https://i.stack.imgur.com/xRwdi.png)

What I can do is rotate and move this line segment, but without raising it up. I can't change shape, length etc. of it. Movement and rotation, as you can see, is limited by the spikes in lattice points. Below is an example of one of possible moves. My question: is it possible to make this line segment parallel to Y-axis?

[![enter image description here](https://i.stack.imgur.com/C1fuo.png)](https://i.stack.imgur.com/C1fuo.png)

I do believe that Chinese Remainder Theorem has something to do with this.