The frame consists of the following characters:
||Left upper corner
||Right upper corner
||Left bottom corner
||Right bottom corner
||Vertical (left and right) border line
||Horizontal (top and bottom) border line
N square frames (1 ≤ N ≤ 15) were sequentially drawn on screen 50 characters wide 20 lines tall. If parts of some frames intersect, only the part of the frame drawn latter remains visible. Each frame lies fully on the screen.
You need to write a program that builds a possible sequence of frames that (if drawn sequentially) would produce the same picture on the screen. Your sequence does not have to be the same with the original sequence used to build the picture on the screen. However, it should not contain more than 2000 frames.
The screen area was originally filled with dots (ASCII 46). Input contains the final picture on the screen after the sequence of frames is drawn.
Your program should write to output the number of frames in the sequence built and the frames coordinates as follows:
Here K is the number of frames, Xi and Yi are coordinates of the upper left frame corner (0 ≤ Xi ≤ 49, 0 ≤ Yi ≤ 19) and Ai is the length of the frame side (2 ≤ Ai). All numbers must be delimited with one or more spaces and/or line breaks.
(see the figure above)
16 11 7
32 14 4
4 8 8
11 6 7
36 11 3
28 8 3
The input should be read using the cp437 encoding or compatible (e.g. cp866). You can download the sample input here
Problem Source: USU Championship 1997