#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll,ll>;

ll solve() {
    ll N;
    cin >> N;
    vector<ll> A(N), B(N), P(N);
    for ( int i = 0; i < N; i++ ) cin >> A[i];
    for ( int i = 0; i < N; i++ ) cin >> B[i];
    for ( int i = 0; i < N; i++ ) {
        cin >> P[i];
        P[i]--;
    }
    vector<pii> ws(N);
    for ( int i = 0; i < N; i++ ) {
        ws[i] = pii(A[i],i);
    }
    sort(ws.begin(), ws.end());
    vector<ll> rP(N);   // 荷物iを持っている人
    for ( int i = 0; i < N; i++ ) {
        rP[P[i]] = i;
    }
    
    vector<pii> ans;
    for ( int k = 0; k < N; k++ ) {
        ll a = ws[k].first;
        int i = ws[k].second;
        if ( P[i] == i ) continue;
        int j = rP[i];
        if ( B[P[i]] >= A[i] ) return -1;
        if ( B[P[j]] >= A[j] ) return -1;
        ans.push_back(pii(i,j));
        swap(rP[P[i]],rP[P[j]]);
        swap(P[i],P[j]);
        // cout << "\n";
        // cout << "P";
        // for ( int i = 0; i < N; i++ ) {
        //     cout << P[i] << " ";
        // }
        // cout << "\n";
        // cout << "rP";
        // for ( int i = 0; i < N; i++ ) {
        //     cout << rP[i] << " ";
        // }
        // cout << "\n";
    }
    cout << ans.size() << "\n";
    for ( int i = 0; i < ans.size(); i++ ) {
        cout << ans[i].first+1 << " " << ans[i].second+1 << "\n";
    }
    return 0;
}

int main() {
    auto ans = solve();
    if ( ans < 0 ) {
        cout << ans << "\n";    
    }
    return 0;
}
#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
template <class T>
inline bool chmin(T &a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}

template <typename T>
T mypow(T x, T n, const T &p = -1)
{ //x^nをmodで割った余り
	T ret = 1;
	while (n > 0)
	{
		if (n & 1)
		{
			if (p != -1)
				ret = (ret * x) % p;
			else
				ret *= x;
		}
		if (p != -1)
			x = (x * x) % p;
		else
			x *= x;
		n >>= 1;
	}
	return ret;
}

using namespace std;
// using namespace atcoder;

void solve()
{
	int n;
	cin>>n;
	vector<int>a(n),b(n),p(n);
	rep(i,n)cin>>a[i];
	rep(i,n)cin>>b[i];
	rep(i,n)cin>>p[i],p[i]--;
	auto c=p;
	sort(all(c));

	int ans=0;
	vector<pair<int,int>>pp;
	rep(i,n){
		if(p[i]!=i){
			if(a[i]<=b[p[i]]||a[p[i]]<=b[p[p[i]]])break;
			else if(p[p[i]]==i){
				pp.eb(i+1,p[i]+1);
				swap(p[i],p[p[i]]);
				++ans;
			}
			else if(a[i]>b[p[p[i]]]){
				pp.eb(i+1,p[i]+1);
				swap(p[i],p[p[i]]);
				++ans;
				--i;
			}
		}
	}

	if(c==p){
		cout<<ans<<"\n";
		rep(i,pp.size()){
			cout<<pp[i].first<<" "<<pp[i].second<<"\n";
		}
	}
	else cout<<-1<<"\n";
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}
