#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("trapv")
#pragma GCC target("sse4")

#include<bits/stdc++.h>
using namespace std;

typedef pair<int, int> pi;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long long int ll;
typedef unsigned long long int  ull;
typedef priority_queue<ll> mxhpl;
typedef priority_queue<int> mxhpi;
typedef priority_queue<ll, vector<ll>, greater<ll>> mnhpl;
typedef priority_queue<int, vector<int>, greater<int>> mnhpi;

#define rep(i,start,end) for(ll i = start; i <= end; ++i)
#define rrep(i,end,start) for(ll i = end; i >= start; --i)
#define parr(a,n) rep(i,0,n-1){cout << a[i] << " ";}cout<<"\n"
#define sarr(a,n) rep(i,0,n-1)cin >> a[i]
#define pb push_back
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define mset(a,x) memset(a, x, sizeof(a))
#define ps(x,y) fixed<<setprecision(y)<<x //cout << ps(ans, decimal places);
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)

// DEBUGGING
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char* x) { cerr << '\"' << x << '\"'; }
void __print(const string& x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template<typename T, typename V>
void __print(const pair<T, V>& x) { cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}'; }
template<typename T>
void __print(const T& x) { int f = 0; cerr << '{'; for (auto& i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}"; }
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) { __print(t); if (sizeof...(v)) cerr << ", "; _print(v...); }
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

// Fast IO
void IO() {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
#endif
}

#define MOD 1000000007

//CODE
/*******************************************************/
#define MX 200001 

ll n;


void solve() {
  cin >> n;
  vl a(n), b(n), c(n), whoHasMyBag(n);

  sarr(a, n);
  sarr(b, n);
  sarr(c, n);
  vector<pll> wp;
  rep(i, 0, n - 1) {
    if (c[i] - 1 != i && a[i] <= b[c[i] - 1]) {
      cout << "-1\n";
      return;
    }
    c[i]--;
    wp.pb({ a[i],i });
    whoHasMyBag[c[i]] = i;
  }

  sort(all(wp));
  vector<pll> ans;
  for (auto p : wp) {
    if (c[p.S] == p.S) continue;
    ans.pb({ p.S + 1,whoHasMyBag[p.S] + 1 });

    c[whoHasMyBag[p.S]] = c[p.S];
    whoHasMyBag[c[whoHasMyBag[p.S]]] = whoHasMyBag[p.S];
  }

  // debug("TEST");
  cout << ans.size() << "\n";
  for (auto p : ans) {
    cout << p.F << " " << p.S << "\n";
  }
  // debug(ans, c);
}

int main() {
  IO();
  int t = 1;

  // cin >> t;

  while (t--) {
    solve();
  }
  return 0;
}

/*******************************************************/

#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int N; cin >> N; 
	int A[200010], B[200010], P[200010]; 
	int pos[200010]; 
	pair<int, int> W[200010]; 
	for(int i = 1; i <= N; i++) cin >> A[i]; 
	for(int i = 1; i <= N; i++) cin >> B[i]; 
	for(int i = 1; i <= N; i++) cin >> P[i]; 
	for(int i = 1; i <= N; i++) pos[P[i]] = i; 
	for(int i = 1; i <= N; i++){
		W[i].first = A[i]; W[i].second = i; 
	}
	sort(W+1, W+N+1); 
	vector<pair<int, int>> ans; 
	for(int i = 1; i <= N; i++){
		int a = W[i].second;
		if(P[a] == a) continue;  
		if(A[a] <= B[P[a]]){
			cout << -1 << "\n"; 
			return 0; 
		}
		ans.emplace_back(a, pos[a]); 
		int x = P[a]; int y = pos[a]; 
		P[a] = a; P[y] = x; 
		pos[a] = a; pos[x] = y; 
	}
	cout << ans.size() << "\n"; 
	for(auto p : ans){
		cout << p.first << " " << p.second << "\n"; 
	}
}