/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

const int N=2e5+10;

inline int Rint(int &r){
	int b=1,c=getchar();r=0;
	while(c<'0' || '9'<c) b=c=='-'? -1:b,c=getchar();
	while('0'<=c && c<='9') r=(r<<1)+(r<<3)+(c^'0'),c=getchar();
	return r*=b;
}

int n,m,nstk,cnt;
int wei[N],now[N],uni[N],ans[N<<1][2],stk[N],fstk[N];
pair<int,int> lmt[N];
bool vis[N];

void Answer(int a,int b){
	a=lmt[a].second,b=lmt[b].second;
	ans[++m][0]=a,ans[m][1]=b;
	swap(now[a],now[b]);
}
int main(){
	Rint(n);
	for(int i=1;i<=n;i++) Rint(lmt[i].first),lmt[i].second=i;
	for(int i=1;i<=n;i++) Rint(wei[i]);
	for(int i=1;i<=n;i++) Rint(now[i]);
	for(int i=1;i<=n;i++)
		if(now[i]!=i && wei[now[i]]>=lmt[i].first){
			printf("-1\n");
			return 0;
		}
	sort(lmt+1,lmt+1+n);
	for(int i=1;i<=n;i++){
		uni[lmt[i].second]=i;
		if(lmt[i].second==now[lmt[i].second])
			vis[i]=true;
	}
	for(int i=1;i<=n;i++)
		if(!vis[i]){
			nstk=0;
			int tmp=i;
			while(true){
				stk[++nstk]=tmp;
				tmp=uni[now[lmt[tmp].second]];
				if(tmp==i) break;
			}
			fstk[cnt=1]=stk[1];
			for(int j=2;j<=nstk;j++)
				if(fstk[cnt]>stk[j]) Answer(fstk[cnt],stk[j]);
				else fstk[++cnt]=stk[j];
			for(int j=1;j<cnt;j++)
				Answer(fstk[j],fstk[cnt]);
		}
	//for(int i=1;i<=n;i++)
	//	printf("%d %d\n",i,now[i]);
	printf("%d\n",m);
	for(int i=1;i<=m;i++)
		printf("%d %d\n",ans[i][0],ans[i][1]);
	return 0;
}

#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int N = 200001;

int A[N], B[N], P[N], IP[N];
vector<pii > v, ans;

int main() {
  int n;
  S(n);
  rep(i,1,n+1) {
    S(A[i]);
    v.pb(mp(A[i], i));
  }
  rep(i,1,n+1) {
    S(B[i]);
  }
  rep(i,1,n+1) {
    S(P[i]);
    IP[P[i]] = i;
  }

  sort(all(v));
  rep(i,0,v.size()) {
    int x = v[i].SS;
    if(IP[x] == x) continue;
    if(B[P[x]] >= A[x]) {
      P(-1);
      return 0;
    }
    ans.pb(mp(x, IP[x]));
    int y = P[x];
    IP[y] = IP[x];
    P[IP[x]] = y;
    IP[x] = x;
    P[x] = x;
  }
  P((int)ans.size());
  rep(i,0,ans.size()) {
    printf("%d %d\n",ans[i].FF, ans[i].SS);
  }
  return 0;
}
