#include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()

using namespace std;
using lint = long long;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

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

		vector<int> a(n), b(n);
		for (int i = 0; i < n; i++) cin >> a[i];
		for (int i = 0; i < n; i++) cin >> b[i];
		if (accumulate(all(a), 0) != accumulate(all(b), 0)) {
			cout << -1 << '\n';
			continue;
		}

		vector<int> p(n);
		for (int i = 0; i < n; i++) {
			p[i] = a[i] - b[i];
		}
		vector<pair<int, int>> ans;
		for (int i = 0; i < n - 1; i++) {
			if (p[i] == 0) continue;
			if (p[i] > 0) {
				for (int j = i + 1; j < n && p[i] != 0; j++) {
					if (p[j] < 0) {
						int t = min(abs(p[i]), abs(p[j]));
						p[i] -= t;
						p[j] += t;
						while (t--) ans.push_back({ i + 1, j + 1 });
					}
				}
			}
			else {
				for (int j = i + 1; j < n && p[i] != 0; j++) {
					if (p[j] > 0) {
						int t = min(abs(p[i]), abs(p[j]));
						p[i] += t;
						p[j] -= t;
						while (t--) ans.push_back({ j + 1, i + 1 });
					}
				}
			}
		}
		cout << ans.size() << '\n';
		for (auto& [f, t] : ans) { cout << f << " " << t << '\n'; }
	}
	return 0;
}