Imagine

No attempts yetTime limit1sMemory limit256 MB

Problem

Imagine a made-up city with two fictional political parties named A and B (the names are short, and nobody minded).

In the center of the city stands a billboard that is $10.24$ metres wide and $10.24$ metres tall — a grid of $1024 \times 1024$ cells, each one square centimetre. Every so often an activist places a $1,\text{cm} \times 1,\text{cm}$ sticker showing either an A or a B onto a single cell. A newly placed sticker completely covers whatever was on that cell before, so only the most recently placed sticker on a cell is ever visible.

Before any sticker is placed, the board is coloured like a checkerboard with an A in the top-left corner at $x = y = 1$. Precisely, the cell in column $x$ and row $y$ starts as A when $x + y$ is even, and as B when $x + y$ is odd:

        x=1  x=2  x=3  x=4
 y=1:    A    B    A    B
 y=2:    B    A    B    A
 y=3:    A    B    A    B
 y=4:    B    A    B    A

Actions are processed in chronological order and come in two kinds: placing a sticker on one cell, and asking how many A cells and how many B cells currently lie inside a given axis-aligned subrectangle of the board. Answer every such question efficiently.

Input

The input describes a single scenario.

  • The first line contains one integer $N$ with $1 \le N \le 1{,}000{,}000$: the total number of actions (stickers and queries combined).
  • Each of the next $N$ lines is one action, in one of two forms:
    • A x y or B x y — place a sticker of the named party on the cell in column $x$, row $y$, where $1 \le x, y \le 1024$.
    • R x1 y1 x2 y2 — a query over the subrectangle with top-left corner $(x_1, y_1)$ and bottom-right corner $(x_2, y_2)$, where $1 \le x_1 \le x_2 \le 1024$ and $1 \le y_1 \le y_2 \le 1024$.

On every line the letter and the integers are separated by single spaces. Stickers and queries may be interleaved in any order.

Output

For each query, in the order the queries appear in the input, print one line with two integers separated by a single space: the number of A cells and the number of B cells currently inside the queried subrectangle.