then that answer is always "yes," which is exactly why early algorithms (including those which pre-dated digital computers) sorted their data. It's why Knuth titled his book,
Easily the best way for the OP to solve this problem is to pre-read the first line. Then, in the loop, move the values and read the next line. The algorithm then concerns itself, not with the line just read, but with the line that was read before that.