Problem
Chef is organizing "Three-People Contests" for his nephews.
Alice, Bob, and Charles took part in contests, where, in the contest, they got , , and points respectively.
For each person, find the longest subarray , such that the person gets the first place if we only consider the contests in the range . The length of such subarray is , or , if there are no such subarrays.
A person gets first place if the total points they score in these contests are not less than that of any other contestant.
Input Format
- The first line of input will contain a single integer , denoting the number of test cases.
- Each test case consists of multiple lines of input.
- The first line of each test case contains one integer — the number of contests organized by Chef.
- The second line of each test case contains an array of integers, , the score of Alice in the contests.
- The third line contains an array of integers, , the score of Bob in the contests.
- The fourth line contains an array of integers, , the score of Charles in the contests.
Output Format
For each test case, output on a new line, space-separated integers, answer for Alice, Bob, and Charles in the same order.
Constraints
- The sum of over all test cases won't exceed .
Sample 1:
3 6 5 5 8 1 3 7 0 8 1 1 2 0 8 8 3 9 3 3 4 1 1 1 1 1 1 1 1 1 1 1 1 2 3 3 2 2 1 1
4 1 6 4 4 4 2 0 0
Explanation:
Test case : Alice gets first place in the contests between and as she gets points, while Bob and Charles get and points, respectively. The answer for Alice is .
Bob gets first place in the contest with score . Note that in , Charles also gets points, so they both get first place. The answer for Bob is .
Charles wins in and , as he gets points, which is not less than and . The answer for Charles is .
Test case : Everyone has a score of points. Since the score of each person is not less than the score of other people, everyone gets the first place. Thus, and for everyone. The length of the array is .
ConversionConversion EmoticonEmoticon