Colored Paper

No attempts yetTime limit1sMemory limit64 MB

Problem

Rectangular sheets of colored paper, each a different color, are placed on a plane one at a time until NN sheets are down. No sheet is placed at an angle, so any two sides of any two sheets are either parallel or perpendicular. Figure 1 shows sheets 1, 2, and 3 placed in that order.

Figure 1

Placing a fourth sheet as in figure 2 hides sheet 3 completely. Sheets 1 and 2 are partly hidden, and sheet 4 is fully visible.

Figure 2

Write a program that computes the visible area of each sheet after the NN sheets are placed at the given positions, in the given order.

Input

The first line has the number of sheets NN (1N1001 \le N \le 100). Each of the next NN lines describes one sheet, in the order the sheets are placed.

The plane is a grid at most 1001 cells wide and at most 1001 cells tall. Each cell is a square of width 1, height 1, and area 1.

Take a grid 6 cells wide and 6 cells tall as an example. The pair (a,b)(a, b) written inside a cell is the number of that cell. The bottom left cell is (0,0)(0, 0) and the top right cell is (5,5)(5, 5).

A sheet is given by four integers xx, yy, ww, hh: the number of its bottom left cell, its width, and its height. The gray sheet in the picture above has its bottom left cell at (1,4)(1, 4), width 3, and height 2, so it is written as 1 4 3 2. The width and the height are integers of at least 1, and no sheet reaches outside the grid.

Output

Print the visible area of each sheet as one integer on its own line, in the order the sheets are given in the input. If a sheet is not visible at all, print 0.