lab4v2: try to make optimal. from end to begin
another fixes, not works
another fixes, still not works
need to decide how to build reverse list
lab is done. looks pretty ugly