CF1214G Feeling Good

Description

Recently biologists came to a fascinating conclusion about how to find a chameleon mood. Consider chameleon body to be a rectangular table $ n \times m $ , each cell of which may be green or blue and may change between these two colors. We will denote as $ (x, y) $ ( $ 1 \leq x \leq n $ , $ 1 \leq y \leq m $ ) the cell in row $ x $ and column $ y $ . Let us define a chameleon good mood certificate to be four cells which are corners of some subrectangle of the table, such that colors in opposite cells among these four are similar, and at the same time not all of the four cell colors are similar. Formally, it is a group of four cells $ (x_1, y_1) $ , $ (x_1, y_2) $ , $ (x_2, y_1) $ , $ (x_2, y_2) $ for some $ 1 \leq x_1 < x_2 \leq n $ , $ 1 \leq y_1 < y_2 \leq m $ , that colors of $ (x_1, y_1) $ and $ (x_2, y_2) $ coincide and colors of $ (x_1, y_2) $ and $ (x_2, y_1) $ coincide, but not all of the four cells share the same color. It was found that whenever such four cells are present, chameleon is in good mood, and vice versa: if there are no such four cells, chameleon is in bad mood. You are asked to help scientists write a program determining the mood of chameleon. Let us consider that initially all cells of chameleon are green. After that chameleon coloring may change several times. On one change, colors of contiguous segment of some table row are replaced with the opposite. Formally, each color change is defined by three integers $ a $ , $ l $ , $ r $ ( $ 1 \leq a \leq n $ , $ 1 \leq l \leq r \leq m $ ). On such change colors of all cells $ (a, b) $ such that $ l \leq b \leq r $ are replaced with the opposite. Write a program that reports mood of the chameleon after each change. Additionally, if the chameleon mood is good, program should find out any four numbers $ x_1 $ , $ y_1 $ , $ x_2 $ , $ y_2 $ such that four cells $ (x_1, y_1) $ , $ (x_1, y_2) $ , $ (x_2, y_1) $ , $ (x_2, y_2) $ are the good mood certificate.

Input Format

N/A

Output Format

N/A