5665: Dyson Box

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:0 解决:0

题目描述

输入

输出

样例输入 复制

4
1 2
3 2
2 1
4 1

样例输出 复制

4 4
8 6
8 8
10 8

提示

In the only example, the inside of the box is as below, and the bold lines mark the outline of all the cubes. After the 1-st event: