Time limit
2s
Memory limit
128 MB
There are N points on a plane. Each point has an integer weight S, and its coordinate is given as (r, c), where r is the row and c is the column.
You want to place one axis-aligned rectangle of vertical length A and horizontal length B and select the points inside it. With integer coordinates, two points can be placed inside the same such rectangle only when their row coordinates differ by less than A and their column coordinates differ by less than B.
Among the weights of the points inside the rectangle, maximize the difference between the largest weight and the smallest weight. Find that maximum possible difference.

In the figure above, placing the rectangle as the gray region makes the difference between the largest and smallest included weights equal to 7, and no placement can make it larger.
The first line contains three integers N, A, and B. (1 ≤ N ≤ 1,000, 1 ≤ A ≤ 2,000,000, 1 ≤ B ≤ 2,000,000)
Each of the next N lines contains three integers r, c, and S: the row coordinate, column coordinate, and weight of one point. (1 ≤ r ≤ 2,000,000, 1 ≤ c ≤ 2,000,000, 1 ≤ S ≤ 2,000,000)
No two points share the same position.
Print the maximum possible difference between the largest and smallest weights among the points included in the rectangle.