#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<vector>
#define fs(i,x,y) for(int i=(x),_=(y);i<=_;++i)
#define fn(i,x,y) for(int i=(x),_=(y);i>=_;--i)
#define tor(i,v,x) for(int i=head[x],v=to[i];i;i=nxt[i],v=to[i])
#define Li inline
#define R register int
#define ls(x) ch[x][0]
#define rs(x) ch[x][1]
#define mpi(x,y) make_pair(x,y)
#define pi pair<int,int>
//#define int ll
using namespace std;
typedef long long ll;
template<typename T>
void read(T &x){
	x=0;char ch=getchar();bool f=0;
	while(ch<'0'||ch>'9'){
		if(ch=='-')f=1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
	x=f?-x:x;
}

const int N=2e5+7;
int n,m;
int a[N],b[N],p[N],id[N],q[N];
vector<pi>v;

bool cmp(int lhs,int rhs){
	return b[lhs]>b[rhs];
}

signed main(){
	read(n);
	fs(i,1,n)read(a[i]);
	fs(i,1,n)id[i]=i,read(b[i]);
	fs(i,1,n)read(p[i]),q[p[i]]=i;
	sort(id+1,id+n+1,cmp);
	fs(i,1,n){
		int x=id[i];
		if(q[x]==x)continue;
		if(a[q[x]]>b[x]&&a[x]>b[p[x]]){
			v.push_back(mpi(q[x],x));
			p[q[x]]=p[x];
			q[p[x]]=q[x];
		}else{
			printf("-1");return 0;
		}
	}
	int len=v.size();
	printf("%d\n",len);
	fs(i,0,len-1){
		printf("%d %d\n",v[i].first,v[i].second);
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define int long long
using vec_int = vector<int>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

signed main(){
    int N; cin>>N;
    vec_int a(N), b(N), p(N); 
    rep(i,N) cin>>a.at(i);
    rep(i,N) cin>>b.at(i);
    rep(i,N) cin>>p.at(i);

    vector<P> person(N);
    rep(i, N)person.at(i) = make_pair(a.at(i), i);
    sort(person.begin(), person.end());
    // 何をやらないといけないかというと、
    // 体重が軽い人の順番に
    // 自分のIDの荷物を持っている人と荷物を交換する
    // 

    map<int, int> assign_map;
    map<int, int> assign_map2;
    rep(i,N){
        assign_map[p.at(i)] = i; // 荷物, 人
        assign_map2[i] = p.at(i); //人, 荷物
    }

    int ans = 0;
    vector<P> ans_vec;
    for(int i=0;i<N;i++){
        int weight, person_ID; tie(weight, person_ID) = person.at(i); 
        //cout<<weight<<" "<<person_ID<<" "<<assign_map[person_ID]<<endl;
        if(person_ID == assign_map2[person_ID]-1){
            continue;
        }
        int nimotu = assign_map2[person_ID];
        if(weight <= b.at(nimotu-1) ){
            cout<<-1<<endl;
            return 0;
        }
        int counter_person = assign_map[person_ID+1]; // person_ID+1の荷物を持っている人
        assign_map2[person_ID] = person_ID+1; 
        assign_map2[counter_person] = nimotu;
        assign_map[nimotu] = counter_person;
        ans_vec.push_back(make_pair(person_ID+1, counter_person+1));
        ans++;
    }
    cout<<ans<<endl;
    rep(i, ans){
        cout<<ans_vec.at(i).first<<" "<<ans_vec.at(i).second<<endl;
    }


    return 0;
}