#include<bits/stdc++.h>
using namespace std;

void solve() {
    int n;
    cin >> n;
    vector<int> A(n), B(n);
    for (int &a : A) {
        cin >> a;
    }
    for (int &b : B) {
        cin >> b;
    }
    int p = 0, m = 0;
    for (int i = 0; i < n; i++) {
        if (A[i] > B[i]) {
            p += A[i] - B[i];
        } else {
            m += B[i] - A[i];
        }
    }
    if (p != m) {
        cout << "-1\n";
        return;
    }
    cout << p << '\n';
    for (int i = 0; i < n; i++) {
        while (A[i] < B[i]) {
            for (int j = 0; j < n; j++) {
                if (A[j] <= B[j]) {
                    continue;
                }
                A[i]++;
                A[j]--;
                cout << j + 1 << ' ' << i + 1 << '\n';
                break;
            }
        }
        while (A[i] > B[i]) {
            for (int j = 0; j < n; j++) {
                if (A[j] >= B[j]) {
                    continue;
                }
                A[i]--;
                A[j]++;
                cout << i + 1 << ' ' << j + 1 << '\n';
                break;
            }
        }
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
};
