Matrix Operations
题号:NC230860
时间限制:C/C++/Rust/Pascal 15秒,其他语言30秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

Given an matrix where each element in the matrix is 0 initailly, you are asked to successively perform n groups of operations on the matrix.

For each group of operations, you are given six parameters x, y, z_1, z_2, z_3 and z_4 and need to do the following operations in order:
  1. Find the maximum element among  , denoted by w_1;
  2. Find the maximum element among , denoted by w_2;
  3. Find the maximum element among , denoted by w_3;
  4. Find the maximum element among , denoted by w_4;
  5. Increase each element by z_1;
  6. Increase each element by z_2;
  7. Increase each element by z_3;
  8. Increase each element by z_4.
After performing each group of operations, you need to output the values of w_1, w_2, w_3 and w_4.

输入描述:

The first line contains an integer n , indicating the number of rows as well as columns in the matrix as well as the number of groups of operations.

Then follow n lines, each of which contains contains six integers x, y , z_1, z_2, z_3 and z_4 , indicating the parameters of a group of operations as described above.

输出描述:

For each operation, output a line containing four integers, indicating the values of w_1w_2w_3 and w_4.
示例1

输入

复制
3
3 3 1 2 3 4
2 3 1 2 3 4
3 2 1 2 3 4

输出

复制
0 0 0 0
1 2 3 4
4 6 6 8