Solved by 38 users: Evgeny, Pupyrev, PetrovSergey, robotact, NSI, DD, Dmitry_Gozman, tomek, Vyshnya, MasterZerg, dragonghy, Cheryl, dan, marek.cygan, liuliang, skywalker, toshiba2, andyzh1314, mikleb, zmy, crazyb0y, tourist, davidsun, Chmeli_BSU, wInuX, Ravent, WsemirZ, zloy_mipt, JohnJones_001, mazahaka, pmnox, defrager, Al.Cash, RAVEman, TTLovePP, ripatti, Dest, avg79.
UserDateAttemptTimeCMSC
mikleb`04 nov 2007`C++500.01652
zmy`21 nov 2007`C++200.02663
pmnox`03 feb 2009`C++400.02744
crazyb0y`22 jan 2008`C++1100.02775
ripatti`17 jun 2010`C++300.01810
JohnJones_001`01 nov 2008`C++100.02922
pmnox`03 feb 2009`C++300.02925
Pupyrev`18 jun 2004`C++10?.??929
Al.Cash`31 aug 2009`C++400.01962
Dmitry_Gozman`13 dec 2005`Kylix400.07999
Ravent`02 aug 2008`C++200.021040
 C++ 25 FPC 9 Kylix 4 Java 1
` >  >  >  >  >  >  >  >  >  > `

## Casket

Time limit = 5 second(s)

Rectangular casket lid is decorated with jewels. All jewel positions has integer coordinates (0 ≤ X,Y ≤ 100). No two jewels are placed to the same place. Jewels form axially symmetry (two axes of symmetry are parallel to sides) picture. But some jewels were lost. The problem is to change positions of minimal number of jewels and make picture axially symmetric.

There may be several solutions, output one of them.

Input The first line contains two even numbers --- lengths of sides of rectangular casket lid. The next line has the number N of jewels and N lines describing jewels positions follow. Each line contains three numbers: jewel id, X and Y jewel's coordinates. Jewels ids are the numbers 1, 2, ... N.

See the figure below: casket with some jewels lost (left) and casket with moved 3-rd and 4-th jewels to their new positions so that picture is axially symmetric (right).

For this figure input data is

```6 4
5
1 1 3
2 1 1
3 4 3
4 4 2
5 5 3
```

Output The first line should contain minimal number M of jewels to move. Next M lines should have the form:

` < jewel id > < new X coordinate >  < new Y coordinate > `

For the casket in the figure above output may be the following:

```2
4 5 1
3 3 2
```

 Input#1```4 12 8 1 1 2 2 3 2 3 1 8 4 1 9 5 1 10 6 3 8 7 3 9 8 3 10 ``` Output#1```2 4 1 3 6 3 3 ```

Author:
Moscow region school contest, 8-9 January 2003
28 January 2003

 © acm.mipt DevGroupThe page was generated in 190ms