#include <bits/stdc++.h>
using namespace std;
const int N = 3e6 + 1e3 + 7;
int T, n, a[N], vis[N];
pair<int, int> f[N][2];
int last[N][2];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> T;
  while (T--) {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i], vis[i] = 0;
    for (int i = 1; i <= n; i++)
      for (int j = 0; j < 2; j++) f[i][j] = {1e9, 1e9};
    f[0][0] = f[0][1] = {-1e9, -1e9};
    for (int i = 1; i <= n; i++) {
      pair<int, int> dp1 = f[i - 1][0], dp2 = f[i - 1][1];
      if (-a[i] > dp1.first)
        dp1.first = -a[i];
      else if (-a[i] > dp1.second)
        dp1.second = -a[i];
      else
        dp1 = {1e9, 1e9};
      if (-a[i] > dp2.first)
        dp2.first = -a[i];
      else if (-a[i] > dp2.second)
        dp2.second = -a[i];
      else
        dp2 = {1e9, 1e9};
      if (dp1 < dp2)
        f[i][0] = dp1, last[i][0] = 0;
      else
        f[i][0] = dp2, last[i][0] = 1;
      dp1 = f[i - 1][0], dp2 = f[i - 1][1];
      if (a[i] > dp1.first)
        dp1.first = a[i];
      else if (a[i] > dp1.second)
        dp1.second = a[i];
      else
        dp1 = {1e9, 1e9};
      if (a[i] > dp2.first)
        dp2.first = a[i];
      else if (a[i] > dp2.second)
        dp2.second = a[i];
      else
        dp2 = {1e9, 1e9};
      if (dp1 < dp2)
        f[i][1] = dp1, last[i][1] = 0;
      else
        f[i][1] = dp2, last[i][1] = 1;
    }
    int ok = 0;
    if (f[n][0].first <= n && f[n][0].second <= n) {
      ok = 1;
      int q = 0;
      for (int i = n; i >= 1; i--) {
        if (!q) a[i] *= -1;
        q = last[i][q];
      }
    } else if (f[n][1].first <= n && f[n][1].second <= n) {
      ok = 1;
      int q = 1;
      for (int i = n; i >= 1; i--) {
        if (!q) a[i] *= -1;
        q = last[i][q];
      }
    }
    if (ok) {
      cout << "YES\n";
      for (int i = 1; i <= n; i++) cout << a[i] << " \n"[i == n];
    } else
      cout << "NO\n";
  }
}

### Prompt

Please create a solution in cpp to 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 = 3e6 + 1e3 + 7;
int T, n, a[N], vis[N];
pair<int, int> f[N][2];
int last[N][2];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> T;
  while (T--) {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i], vis[i] = 0;
    for (int i = 1; i <= n; i++)
      for (int j = 0; j < 2; j++) f[i][j] = {1e9, 1e9};
    f[0][0] = f[0][1] = {-1e9, -1e9};
    for (int i = 1; i <= n; i++) {
      pair<int, int> dp1 = f[i - 1][0], dp2 = f[i - 1][1];
      if (-a[i] > dp1.first)
        dp1.first = -a[i];
      else if (-a[i] > dp1.second)
        dp1.second = -a[i];
      else
        dp1 = {1e9, 1e9};
      if (-a[i] > dp2.first)
        dp2.first = -a[i];
      else if (-a[i] > dp2.second)
        dp2.second = -a[i];
      else
        dp2 = {1e9, 1e9};
      if (dp1 < dp2)
        f[i][0] = dp1, last[i][0] = 0;
      else
        f[i][0] = dp2, last[i][0] = 1;
      dp1 = f[i - 1][0], dp2 = f[i - 1][1];
      if (a[i] > dp1.first)
        dp1.first = a[i];
      else if (a[i] > dp1.second)
        dp1.second = a[i];
      else
        dp1 = {1e9, 1e9};
      if (a[i] > dp2.first)
        dp2.first = a[i];
      else if (a[i] > dp2.second)
        dp2.second = a[i];
      else
        dp2 = {1e9, 1e9};
      if (dp1 < dp2)
        f[i][1] = dp1, last[i][1] = 0;
      else
        f[i][1] = dp2, last[i][1] = 1;
    }
    int ok = 0;
    if (f[n][0].first <= n && f[n][0].second <= n) {
      ok = 1;
      int q = 0;
      for (int i = n; i >= 1; i--) {
        if (!q) a[i] *= -1;
        q = last[i][q];
      }
    } else if (f[n][1].first <= n && f[n][1].second <= n) {
      ok = 1;
      int q = 1;
      for (int i = n; i >= 1; i--) {
        if (!q) a[i] *= -1;
        q = last[i][q];
      }
    }
    if (ok) {
      cout << "YES\n";
      for (int i = 1; i <= n; i++) cout << a[i] << " \n"[i == n];
    } else
      cout << "NO\n";
  }
}

```