Submit: 1286 Solved: 137

[Submit][Status][Web Board]

} of length n, and the definition of decreasing number is the number either the previous one is bigger than it or the next one is smaller than it. In other word, the number of index \(i\) is a decreasing number if and only if \( i > 1 \ \& a[i-1] > a[i] \) or \(i < n \ \& \ a[i] > a[i+1]\) . In every turn he will delete all the decreasing numbers at the same time.

The first line of input contains an integer T(1<=T<=10) which is the total number of test cases.

For each test case, there are two lines.

The first line contains a integer n, \(n <= 100000\).

The second line contains n integers, representing the sequence {\(a[i]\)} (1<=\(a_i\)<=100000)

One line per test case, represents the final sequence after Peggy deletes.

```
2
10
1 4 4 3 2 8 9 4 5 7
5
1 8 6 2 4
```

```
1 4 7
1 4
```