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
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

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

#include <stdio.h>
#include <stdint.h>
#include <iostream>
#include <vector>
#include <cstdio>
#include <variant>
#include <list>
#include <initializer_list>
#include <unordered_map>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    size_t nn;
    cin >> nn;

    using EntryL = list<uint32_t>;
    using EntryV = variant<uint32_t, EntryL>;
    unordered_map<uint32_t, EntryV> data;

    uint32_t n = 0;
    for (size_t i = 0; i < nn; ++i) {
        uint32_t cmd, x, y;
        cin >> cmd;
        if(cmd == 1) {
            cin >> x;
            auto ep = data.try_emplace(x, n);
            if (!ep.second) {
                auto& r = ep.first->second;
                if (r.index()) {
                    get<1>(r).push_back(n);
                } else {
                    r = EntryV(initializer_list<uint32_t>{get<0>(r), n});
                }
            }
            ++n;
        } else if (cmd == 2) {
            cin >> x >> y;
            if (x == y) continue;
            auto it = data.find(x);
            if (it == data.end()) {
                continue;
            }

            auto jt = data.find(y);
            if (jt == data.end()) {
                auto nh = data.extract(it);
                nh.key() = y;
                data.insert(move(nh));
            } else {
                auto& rx = it->second;
                auto& ry = jt->second;
                switch (rx.index()*2 + ry.index()) {
                case 0:
                    ry = EntryV(initializer_list<uint32_t>{get<0>(rx), get<0>(ry)});
                    break;
                case 1:
                    get<1>(ry).push_back(get<0>(rx));
                    break;
                case 2:
                    get<1>(rx).push_back(get<0>(ry));
                    swap(rx, ry);
                    break;
                case 3:
                    get<1>(ry).splice(get<1>(ry).end(), move(get<1>(rx)));
                    break;
                }
                data.erase(it);
            }
        }
    }

    vector<uint32_t> res;
    res.resize(n);
    for (auto& kv : data) {
        uint32_t k = kv.first;
        if(kv.second.index()) {
            for (uint32_t v : get<1>(kv.second)) {
                res[v] = k;
            }
        } else {
            res[get<0>(kv.second)] = k;
        }
    }
    bool spc = false;
    for (uint32_t x : res) {
        if (spc) cout << ' ';
        cout << x;
        spc = true;
    }
    cout << endl;
    return 0;
}
