You are given two integer sequences and , and two sequences of positive integers and . All four sequences have length .
Choose two (possibly empty) intervals of indices, for and for . Here, are integers satisfying and .
Let and be the sets of values occurring in these intervals, respectively:
The chosen intervals must satisfy . In other words, no value may occur in both intervals.
If , the interval of is empty and . Likewise, if , the interval of is empty and .
The score of the two chosen intervals is
Find the maximum possible score among all valid choices.
输入格式
The input contains one or more test cases. The first line of the input contains an integer (), which is the number of test cases. The descriptions of the test cases follow, each in the format below.
In the first test case, we can choose the interval of and the interval of . More precisely, we can set , , , and . Their sets of values are and , respectively, and they are disjoint. The score is
which is the maximum possible score.
In the second test case, we can choose an empty interval of and the entire interval of . More precisely, , , , and .