to print list in reverse order