Appending a New Column
Fenwick Retail's stock sheet carries one row per product with two figures on it: the opening count and the closing count. A midweek recount produces a third figure for every product, but it is filed separately — one number per line, in the same product order as the sheet. The auditor will only accept a single table, with each product's recount sitting at the end of that product's own row, so the recount that was filed first belongs to the first row, the second to the second row, and so on.
Task: Print the stock sheet with the recount added to each row.
Input
The first line holds an integer n, the number of products. Each of the next n lines holds that product's two figures separated by a space. Each of the n lines after that holds one recount figure, in the same product order.
Output
n lines, each holding three figures separated by single spaces: the product's two original figures in their original order, then that product's recount. Write each as a plain integer.
Example:
Input:
2
10 20
30 40
5
6
Output:
10 20 5
30 40 6
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in