477. Doors
Time limit per test: 1.5
second(s)
Memory limit: 65536
kilobytes
input: standard
output: standard
It seems that the Museum of the Modern Technology is the only place where they don't celebrate Halloween! How can they be so far from all the mistical and mysterious? You can hardly believe that two weeks ago the Museum staff have destroyed the last detail that could bring with its ominous creak a bit of Halloween atmosphere to the realm of technology. They have replaced the old wooden doors with new automatic ones, and now they are scratching their heads over how to configure the doors.
By the order of the Director, two automatic doors were purchased. An automatic door is characterized by parameter
t, called the
, which can be set to an integer value from 1 to 10
^{9} during the door installation. Then the door functions on the following principle. If a person passes through the door at time
p, the door opens at time
p 
t and closes at time
p +
t. There is an exceptional case when several people go in a row with a time interval not exceeding 2
t between any two consecutive people. In this case the door opens only once,
t seconds before the first person in the row, and it closes
t seconds after the last person in the row has passed through it. It is very important to set the optimal values of the door parameters. On the one hand, if the doors open and close too often, it will annoy visitors. On the other hand, if both doors stay opened for a long time, visitors can get cold.
More formally, two lists of time moments are given. At the moments
p_{1} <
p_{2} <... <
p_{n} people have passed through the first door, and at the moments
q_{1} <
q_{2} <... <
q_{m} people have passed through the second one. The task is to use the given statistics to find the optimal
for the doors —
t_{1} for the first door and
t_{2} for the second one that satisfy the following conditions:
The total number of openings of the doors must be minimal possible. There is no continuous interval of time that both doors are opened during this interval and its length exceeds the given value d.
Input
The first line of the input contains three integers n, m and d (1 ≤ n, m ≤ 5000, 1 ≤ d ≤ 10^{9}). The second line contains numbers p_{i}, and the third line contains numbers q_{i}, given in the ascending order (1 ≤ p_{i}, q_{i} ≤ 10^{9}).
Output
Output two integers t_{1} and t_{2}, separated by a single space. If there are multiple solutions, output any. If there is no solution, output "No solution
".
Example(s)
sample input

sample output

3 2 4
1 6 13
7 11

3 2
