/* hello.cpp */
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define ll long long
using namespace std;
void test_case() 
{
    int n;
    cin >> n;
    int a[n], b[n];
    ll asum = 0, bsum = 0;
    for(int i = 0; i < n; i++) 
    {
        cin >> a[i];
        asum += a[i];
    }
    for(int i = 0; i < n; i++) 
    {
        cin >> b[i];
        bsum += b[i];
    }
    if(asum != bsum)
    {
        cout << "-1\n";
        return;
    }
    vector<pair<int, int> > fir;
    vector<pair<int, int> > sec;
    int ans = 0;
    for(int i = 0; i < n; i++)
    {
        int diff = abs(a[i] - b[i]);
        if(diff > 0)
        {
            pair<int, int> p (diff, i+1);
            if(a[i] > b[i]) fir.push_back(p);
            else 
            {
                sec.push_back(p);
                ans += p.first;
            }
        }
    }
    cout << ans << "\n";
    while(!fir.empty())
    {
        cout << fir.back().second << " " << sec.back().second << "\n";
        fir.back().first--;
        sec.back().first--;
        if(fir.back().first == 0) fir.pop_back();
        if(sec.back().first == 0) sec.pop_back();
    }

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int tc = 1;
    cin >> tc;
    
    while(tc--)
    {
        test_case();
    }
    return 0;
}