A rectangular frame was divided into pieces. Each piece can be either a line segment or a corner—two segments joined at a right angle.
Based on the given segment lengths, restore the original frame or determine that it is impossible. The pieces can be rotated but cannot be reflected. All pieces must be used.
The input file contains the number of pieces , followed by pairs of integers a_i b_i, describing the lengths of the two segments of the -th corner piece. If a piece is a segment, then a_i = 0 or b_i = 0.
The output file must contain two positive integers —the width and height of the frame, with W \geq H. If a solution does not exist, output . If there are multiple solutions, output the one with the maximum .
Example 1