Password

Given finishes over N years, find the lexicographically largest password substring allowed by rules and count its occurrences.

Medium7ArrayString matchingGreedyNo attempts yetTime limit4sMemory limit256 MB

Problem

In sports, and in professional baseball above all, a "password" is the list of season finishes a team recorded during its dark age, read out in order. The Lotte Giants of Korean professional baseball finished 8th, 8th, 8th, 8th, 5th, 7th and 7th from 2001 to 2007, which left the password 8-8-8-8-5-7-7. In the same league the LG Twins wrote 6-6-6-8-5-8-7-6-6-7 from 2003 to 2012, and the Hanwha Eagles have been writing 5-8-8-6-8-9-9-6 since 2008.

To use the word for every professional league and not for baseball alone, define a password as follows.

  1. A password is the string you get by writing the finishes of consecutive years in order and putting a hyphen - between neighboring finishes. A team that finished 8th, 11th, 7th and 6th in four consecutive years gives 8-11-7-6.
  2. Every finish inside a password must be larger than half the number of teams in that league. In a league with 8 or 9 teams, only finishes of 5 or lower can be used.
  3. The length of a password is at least L1L_1 and at most L2L_2.

When several candidates satisfy the rules, pick the one whose sequence of finishes is largest in dictionary order, so that reading it hits hardest. Compare two candidates finish by finish as numbers; at the first position where the finishes differ, the candidate with the larger finish is larger. If one candidate matches the whole beginning of the other, the longer one is larger. In a league with 8 teams, a team that finished 8th, 7th, 2nd, 8th, 7th and 7th with L1=2L_1 = 2 and L2=3L_2 = 3 has the password 8-7-7. Under the same conditions, the finishes 8th, 7th, 2nd, 7th, 7th and 7th give the password 8-7.

You are given the finishes of one team over NN years in a league of KK teams. Find the password of this team and the number of times it appears in the record of NN finishes. Occurrences that overlap each other are counted separately.

Input

The first line has the number of test cases TT.

The first line of each test case has four integers KK, NN, L1L_1, L2L_2 separated by spaces. (1K1000001 \le K \le 100000, 1N2000001 \le N \le 200000, 1L1L2N1 \le L_1 \le L_2 \le N)

The second line of each test case has NN integers, the finishes of the team over NN years. The ii-th integer RiR_i is the finish in year ii. (1RiK1 \le R_i \le K)

Output

Print two lines for each test case.

Print the password on the first line, and print the number of times it appears in the record on the second line. If no password satisfies the rules, print -1 on the first line and 0 on the second line.