well... just... output it in the opposite order? I don't know what kind of data structure you're saving the results in, but that shouldn't be too problematic. Unless you aren't saving the lines anywhere, then of course it doesn't work (unless you're using recursion).