#include <iostream>
#include <algorithm>
#include "legos.h"
using namespace std;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int t;
    cin >> t;

    while (t--) {
        int n;
        cin >> n;

        vector <int> v(n);

        for (int& x : v) {
            cin >> x;
        }

        auto [flag, moves] = solve(v);

        if (flag) cout << "Yes\n";
        else cout << "No\n";

        for (auto [idx, cnt] : moves) {
            cout << idx << ' ' << cnt << '\n';
        }
    }
    
    return 0;

}