#include <bits/stdc++.h>
using namespace std;
vector<int> a[2];
vector<int> dp[2];
vector<int> trace[2];
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  int n, t;
  cin >> t;
  while (t--) {
    cin >> n;
    a[0].resize(n + 1), a[1].resize(n + 1);
    for (int i = 1; i <= n; ++i) {
      cin >> a[0][i];
      a[1][i] = -a[0][i];
    }
    dp[0].resize(n + 1), dp[1].resize(n + 1);
    trace[0].resize(n + 1), trace[1].resize(n + 1);
    a[0][0] = a[1][0] = -n - 1;
    dp[0][0] = dp[1][0] = -n - 1;
    for (int i = 1; i <= n; ++i) {
      dp[0][i] = dp[1][i] = n + 1;
      for (int j = 0; j < 2; ++j) {
        if (dp[j][i - 1] > n) continue;
        for (int k = 0; k < 2; ++k) {
          if (dp[j][i - 1] < a[k][i] && a[j][i - 1] < dp[k][i]) {
            dp[k][i] = a[j][i - 1];
            trace[k][i] = j;
          }
          if (a[j][i - 1] < a[k][i] && dp[j][i - 1] < dp[k][i]) {
            dp[k][i] = dp[j][i - 1];
            trace[k][i] = j;
          }
        }
      }
    }
    if (dp[0][n] > n && dp[1][n] > n)
      cout << "NO\n";
    else {
      cout << "YES\n";
      int p = trace[0][n] > n;
      for (int i = n; i > 0; --i) {
        a[0][i] = a[p][i];
        p = trace[p][i];
      }
      for (int i = 1; i <= n; ++i) cout << a[0][i] << " \n"[i == n];
    }
  }
  return 0;
}

### Prompt

In cpp, your task is to solve 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;
vector<int> a[2];
vector<int> dp[2];
vector<int> trace[2];
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  int n, t;
  cin >> t;
  while (t--) {
    cin >> n;
    a[0].resize(n + 1), a[1].resize(n + 1);
    for (int i = 1; i <= n; ++i) {
      cin >> a[0][i];
      a[1][i] = -a[0][i];
    }
    dp[0].resize(n + 1), dp[1].resize(n + 1);
    trace[0].resize(n + 1), trace[1].resize(n + 1);
    a[0][0] = a[1][0] = -n - 1;
    dp[0][0] = dp[1][0] = -n - 1;
    for (int i = 1; i <= n; ++i) {
      dp[0][i] = dp[1][i] = n + 1;
      for (int j = 0; j < 2; ++j) {
        if (dp[j][i - 1] > n) continue;
        for (int k = 0; k < 2; ++k) {
          if (dp[j][i - 1] < a[k][i] && a[j][i - 1] < dp[k][i]) {
            dp[k][i] = a[j][i - 1];
            trace[k][i] = j;
          }
          if (a[j][i - 1] < a[k][i] && dp[j][i - 1] < dp[k][i]) {
            dp[k][i] = dp[j][i - 1];
            trace[k][i] = j;
          }
        }
      }
    }
    if (dp[0][n] > n && dp[1][n] > n)
      cout << "NO\n";
    else {
      cout << "YES\n";
      int p = trace[0][n] > n;
      for (int i = n; i > 0; --i) {
        a[0][i] = a[p][i];
        p = trace[p][i];
      }
      for (int i = 1; i <= n; ++i) cout << a[0][i] << " \n"[i == n];
    }
  }
  return 0;
}

```