eolymp
bolt
Try our new interface for solving problems
Problems

Thief of clay

Thief of clay

Mrs. Terry - art teacher at the kindergarten - like when her children sculpt something out of clay. One of her jobs is to give a piece of clay the shape of a rectangular bar and measure its sides. However, in each group is always a kid who tries to take away some clay from a friend. Since Mrs. Terry always gives all children equal pieces of clay, you can write a program that will help find the kidnapper of Mrs. Terry Clay and his sacrifice on the results of measurements of modeled children bars. \InputFile Given one or more groups of children, which ends with the transfer line containing \textbf{-1}. Each group begins with a line containing \textbf{n} - number of children in the group. Then there are \textbf{n} lines of information about pupils. Each row contains three positive numbers representing the size of the resulting bar, and the child's name. In any group of at least \textbf{2} and no more than \textbf{9} students. Child's name up to \textbf{8} letters. Mrs. Terry gives at most by \textbf{250} cubic units of clay to each student. The group is exactly one thief and a victim. \OutputFile Type one row for each group containing the names of the kidnapper and his victim, as shown in the example.
Time limit 1 second
Memory limit 64 MiB
Input example #1
3
10 10 2 Jill
5 3 10 Will
5 5 10 Bill
4
2 4 10 Cam
4 3 7 Sam
8 11 1 Graham
6 2 7 Pam
-1
Output example #1
Bill Will
Graham Cam