You are given a linked list that contains N integers. You have performed the following reverse operation on the list:
Now, you are required to retrieve the original list.
Note: You should use the following definition of the linked list for this problem:
class Node {
Object data;
Node next;
}
Input format
Output format
Print the N elements of the original list.
Constraints
1≤N≤103
1≤Ai≤109
In the sample, the original list is {24,18,2,3,5,7,9,12,6} which when reversed according to the operations will result in the list given in the sample input.