#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5, inf = 1e9;
int T, n, p[N], dp[N][2][2], a[N];
pair<int, int> pre[N][2][2];
void print() {
  for (int pos = 0; pos < 2; pos++)
    for (int sg = 0; sg < 2; sg++)
      if (dp[n][pos][sg] != inf) {
        printf("YES\n");
        for (int j = n; j >= 1; j--) {
          a[j] = sg ? p[j] : -p[j];
          auto pr = pre[j][pos][sg];
          pos = pr.first, sg = pr.second;
        }
        for (int j = 1; j <= n; j++) printf("%d ", a[j]);
        printf("\n");
        return;
      }
  printf("NO\n");
}
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
    for (int i = 1; i <= n; i++)
      for (int pos = 0; pos < 2; pos++)
        for (int sg = 0; sg < 2; sg++) dp[i][pos][sg] = inf;
    dp[1][0][0] = -inf, dp[1][0][1] = -inf;
    for (int i = 1; i < n; i++)
      for (int pos = 0; pos < 2; pos++)
        for (int sg = 0; sg < 2; sg++)
          if (dp[i][pos][sg] != inf) {
            for (int sig = 0; sig < 2; sig++) {
              int z = sig ? p[i + 1] : -p[i + 1], x, y;
              if (!pos)
                x = sg ? p[i] : -p[i], y = dp[i][pos][sg];
              else
                x = dp[i][pos][sg], y = sg ? p[i] : -p[i];
              if (y < z && z < x) {
                if (x < dp[i + 1][1][sig]) {
                  dp[i + 1][1][sig] = x;
                  pre[i + 1][1][sig] = {pos, sg};
                }
              } else if (z > x) {
                if (y < dp[i + 1][0][sig]) {
                  dp[i + 1][0][sig] = min(dp[i + 1][0][sig], y);
                  pre[i + 1][0][sig] = {pos, sg};
                }
              }
            }
          }
    print();
  }
  return 0;
}

### Prompt

Create a solution in CPP for the following problem:

You are given a permutation p consisting of n integers 1, 2, ..., n (a permutation is an array where each element from 1 to n occurs exactly once).

Let's call an array a bipartite if the following undirected graph is bipartite:

  * the graph consists of n vertices; 
  * two vertices i and j are connected by an edge if i < j and a_i > a_j. 



Your task is to find a bipartite array of integers a of size n, such that a_i = p_i or a_i = -p_i, or report that no such array exists. If there are multiple answers, print any of them.

Input

The first line contains a single integer t (1 ≤ t ≤ 2 ⋅ 10^5) — the number of test cases.

The first line of each test case contains a single integer n (1 ≤ n ≤ 10^6) — the size of the permutation.

The second line contains n integers p_1, p_2, ..., p_n.

The sum of n over all test cases doesn't exceed 10^6.

Output

For each test case, print the answer in the following format. If such an array a does not exist, print "NO" in a single line. Otherwise, print "YES" in the first line and n integers — array a in the second line.

Example

Input


4
3
1 2 3
6
1 3 2 6 5 4
4
4 1 3 2
8
3 2 1 6 7 8 5 4


Output


YES
1 2 3
NO
YES
-4 -1 -3 -2
YES
-3 -2 1 6 7 -8 -5 -4

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5, inf = 1e9;
int T, n, p[N], dp[N][2][2], a[N];
pair<int, int> pre[N][2][2];
void print() {
  for (int pos = 0; pos < 2; pos++)
    for (int sg = 0; sg < 2; sg++)
      if (dp[n][pos][sg] != inf) {
        printf("YES\n");
        for (int j = n; j >= 1; j--) {
          a[j] = sg ? p[j] : -p[j];
          auto pr = pre[j][pos][sg];
          pos = pr.first, sg = pr.second;
        }
        for (int j = 1; j <= n; j++) printf("%d ", a[j]);
        printf("\n");
        return;
      }
  printf("NO\n");
}
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
    for (int i = 1; i <= n; i++)
      for (int pos = 0; pos < 2; pos++)
        for (int sg = 0; sg < 2; sg++) dp[i][pos][sg] = inf;
    dp[1][0][0] = -inf, dp[1][0][1] = -inf;
    for (int i = 1; i < n; i++)
      for (int pos = 0; pos < 2; pos++)
        for (int sg = 0; sg < 2; sg++)
          if (dp[i][pos][sg] != inf) {
            for (int sig = 0; sig < 2; sig++) {
              int z = sig ? p[i + 1] : -p[i + 1], x, y;
              if (!pos)
                x = sg ? p[i] : -p[i], y = dp[i][pos][sg];
              else
                x = dp[i][pos][sg], y = sg ? p[i] : -p[i];
              if (y < z && z < x) {
                if (x < dp[i + 1][1][sig]) {
                  dp[i + 1][1][sig] = x;
                  pre[i + 1][1][sig] = {pos, sg};
                }
              } else if (z > x) {
                if (y < dp[i + 1][0][sig]) {
                  dp[i + 1][0][sig] = min(dp[i + 1][0][sig], y);
                  pre[i + 1][0][sig] = {pos, sg};
                }
              }
            }
          }
    print();
  }
  return 0;
}

```