Given two natural numbers, a and b, represented as reversed linked lists, compute their sum c as another reversed linked list.
Two numbers 132 and 541 are shown in the form of reversed linked lists, and so is their sum which is 673.
Input:
a: 321 : 1 → 2 → 3
b: 654 : 4 → 5 → 6
Output:
c: 975 : 5 → 7 → 9
Input:
a: 501 : 1 → 0 → 5
b: 639 : 9 → 3 → 6
Output:
c: 1140 : 0 → 4 → 1 → 1
For each test case, the input has three lines:
For each test case, the output has a line with space separated digits of ‘c’ in reverse order.
4
3 3
3 4 5
1 0 1
1 4
3
1 2 3 4
3 3
3 4 5
3 0 1
1 2
3
3 4
4 4 6
4 2 3 4
6 4 6
6 4
1 <= T <= 100
1 <= n, m <= 1000