409052: GYM103427 K Matrix Operations
Description
Given an $$$n \times n$$$ matrix where each element $$$a_{i,j}$$$ $$$(1 \le i, j \le n)$$$ 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:
- Find the maximum element among $$$a_{i,j}$$$ $$$(1 \le i < x, 1 \le j < y)$$$, denoted by $$$w_1$$$;
- Find the maximum element among $$$a_{i,j}$$$ $$$(1 \le i < x, y \le j \le n)$$$, denoted by $$$w_2$$$;
- Find the maximum element among $$$a_{i,j}$$$ $$$(x \le i \le n, 1 \le j < y)$$$, denoted by $$$w_3$$$;
- Find the maximum element among $$$a_{i,j}$$$ $$$(x \le i \le n, y \le j \le n)$$$, denoted by $$$w_4$$$;
- Increase each element $$$a_{i,j}$$$ $$$(1 \le i < x, 1 \le j < y)$$$ by $$$z_1$$$;
- Increase each element $$$a_{i,j}$$$ $$$(1 \le i < x, y \le j \le n)$$$ by $$$z_2$$$;
- Increase each element $$$a_{i,j}$$$ $$$(x \le i \le n, 1 \le j < y)$$$ by $$$z_3$$$;
- Increase each element $$$a_{i,j}$$$ $$$(x \le i \le n, y \le j \le n)$$$ 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$$$.
InputThe first line contains an integer $$$n$$$ $$$(2 \le n \le 10^5)$$$, 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$$$ $$$(1 < x, y \le n)$$$, $$$z_1$$$, $$$z_2$$$, $$$z_3$$$ and $$$z_4$$$ $$$(1\le z_1, z_2, z_3, z_4\le 10^9)$$$, indicating the parameters of a group of operations as described above.
OutputFor each operation, output a line containing four integers, indicating the values of $$$w_1$$$, $$$w_2$$$, $$$w_3$$$ and $$$w_4$$$.
ExampleInput3 3 3 1 2 3 4 2 3 1 2 3 4 3 2 1 2 3 4Output
0 0 0 0 1 2 3 4 4 6 6 8