Kites

The autumn is coming! This season is perfect to play with kites. To draw a kite is required form a base with two lines of equal size that are intersecting between them in half, one must be ver- tical and the other must be horizontal. Notice that you can take the complete line or a part of the line. See the example explanation to understand it better. Given a set of horizontal and vertical lines in the 2D plane you have to find the diagonal’s length of the largest kite that is possible to draw also you have to count how many maximum kites is possible to draw in the given plane. Input There are multiple test cases. Each test case begins with a line containing two single-space-separated integers N, the number of vertical lines and M, the number of horizontal lines (1 ≤ N,M ≤ 105). Each of the N lines following describes a vertical line. Each such line is described by three single- spaceseparated integers Xi, Yi, Li representing the vertical line from (Xi, Yi) to (Xi, Yi + Li). Similarly, after the N lines describing vertical lines follow M similar lines describing the horizontal lines. Each such line is described by three single-space-separated integers Xi, Yi, Li representing the horizontal line from (Xi, Yi) to (Xi + Li, Yi). All Xi and Yi are between −109 and 109, inclusive. All Li are between 1 and 109, inclusive. Output For each test case print one line containing two integers D and C, where D is the diagonal’s length of the largest kite found, and C is how many maximum kites is possible to draw in the given plane, if it is not possible to draw any kite with D > 0 then the answer should be D = 0 and C = 0. Explanation: Graphics for first and second cases Sample Input 12 639 0 6 12 089 22 311 142 124 144 Sample Output 62 00