SP28404 ADAFIELD - Ada and Field

Description

Ada the Ladybug owns a beautiful field where she grows vegetables. She often visits local Farmers Market, where she buys new seeds. Since two types of vegetable can't share same field, she always divide the field, by either vertical or horizontal line (she is very precise, so the width of line is negligible). Since she visits Farmers Market almost every day, she has already made a lot of such lines, so she needs your help with finding out the area of biggest field.

Input Format

The first line will contain **0 < T , the number of test-cases.** Then **T** test-cases follow, each beginning with three integers **1 , **1 , top right corner of field (field goes from **\[0,0\]** to **\[N,M\]**) and number of field divisions.**** Afterward **Q** lines follows: **0 x (0 , meaning that line was made vertically, on coordinate **x**** **1 y (0 , meaning that line was made horizontally, on coordinate **y**** Sum of **Q** over all test-cases won't exceed **10 $ ^{6} $**

Output Format

Print **Q** lines, the area of biggest field after each line was made.