A matrix is said to be sparse when almost all its values are zero. Write a program that computes the sum of sparse matrices.
Input is a sequence of cases. Each case consits on the description of two sparse matrix. An sparse matrix is described by a non negative integer number followed by a sequence of integer triples. Triple with defines as the value of the matrix at row column . We assume that and are non negative and that matrix values at non listed positions are zero. For instance, the first output matrix in the sample output below is:
For each case, write the sum of the two input matrices as a sequence of triples. Write only those triples that show a non zero value of the sum matrix. Write one triple at each line. Triples must appear ordered by rows. Triples of the same row must appear ordered by columns. After each case, print a line with ten dashes.
Input
3 1 1 1 0 0 5 2 3 1 5 3 3 1 0 0 -1 2 2 5 1 1 -1 2 3 1 1 0 0 5 1 0 0 -5 3 2 1 -1 0 0 1 1 2 1 2 0 0 -2 2 1 1
Output
0 0 4 2 2 5 2 3 2 3 3 1 ---------- ---------- 0 0 -1 1 2 1 ----------