The difficulty rating of this level is "hard" and maybe this is the reason why you are finding complicated patterns and relations between rows in that picture. In fact, it should be like medium because when I compare programming 3 with this one, 3th level is more harder (and prog3 is like medium, not hard. That's bullshit

). You need realized, that if you want sort lines of this pictures, you will need find something what is unique for each row. (the background do them unique too, therefore you shouldn't ignore it)
I'm sure there is
another way how to solve it too and maybe the algorithm based on sorting which I used is not the best, but it works in 90% of pictures.