/*input
1
58
998244353
1

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=4e5+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
ll mult(ll a,ll b){
    return (a*b)%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    a%=MOD;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
int a[maxn],b[maxn],arr[maxn],cur[maxn],dude[maxn];
int main(){
    ios::sync_with_stdio(false),cin.tie(0);
    int n;
    cin>>n;
    REP(i,n) cin>>a[i];
    REP(i,n) cin>>b[i];
    REP(i,n){
        cin>>arr[i];
        --arr[i];
        if(b[arr[i]]>=a[i] and i!=arr[i]){
            cout<<-1;
            return 0;
        }
    }
    REP(i,n) dude[arr[i]]=i;
    vector<pii> v;
    REP(i,n) v.pb({a[i],i});
    sort(ALL(v));
    vector<pii> ans;
    REP(i,n){
        int z=v[i].s;
        int p=dude[z];
        if(z==p){
            continue;
        }
        ans.pb({z,p});
        dude[arr[z]]=p;
        swap(arr[z],arr[p]);
    }
    cout<<sz(ans)<<'\n';
    for(auto x:ans) cout<<x.f+1<<' '<<x.s+1<<'\n';
}
// Artur Kraska, II UWr

#include <bits/stdc++.h>

#define forr(i, n)                  for(int i=0; i<n; i++)
#define FOREACH(iter, coll)         for(auto iter = coll.begin(); iter != coll.end(); ++iter)
#define FOREACHR(iter, coll)        for(auto iter = coll.rbegin(); iter != coll.rend(); ++iter)
#define lbound(P,R,PRED)            ({typeof(P) X=P,RRR=(R), PPP = P; while(PPP<RRR) {X = (PPP+(RRR-PPP)/2); if(PRED) RRR = X; else PPP = X+1;} PPP;})
#define testy()                     int _tests; scanf("%d", &_tests); FOR(_test, 1, _tests)
#define CLEAR(tab)                  memset(tab, 0, sizeof(tab))
#define CONTAIN(el, coll)           (coll.find(el) != coll.end())
#define FOR(i, a, b)                for(int i=a; i<=b; i++)
#define FORD(i, a, b)               for(int i=a; i>=b; i--)
#define MP                          make_pair
#define PB                          push_back
#define ff                          first
#define ss                          second
#define deb(X)                      X;

#define M 1000000007
#define INF 1000000007LL

using namespace std;

int n;
int waga[1000007], kto_ma[1000007], bagaz[1000007], ktory[1000007];
vector <pair<int, int> > res, v;

void zamien(int nr, int nr2)
{
    res.PB(MP(nr, nr2));
    swap(ktory[nr], ktory[nr2]);

    kto_ma[ktory[nr]] = nr;
    kto_ma[ktory[nr2]] = nr2;
}

int main()
{
    scanf("%d", &n);
    FOR(i, 1, n)
    {
        scanf("%d", &waga[i]);
        v.PB(MP(waga[i], i));
    }
    sort(v.begin(), v.end());

    FOR(i, 1, n)
        scanf("%d", &bagaz[i]);

    FOR(i, 1, n)
    {
        scanf("%d", &ktory[i]);
        kto_ma[ktory[i]] = i;
    }

    for(auto p : v)
    {
        int nr = p.ss;
        //cout << "ogarnia " << nr << endl;
        int nr2 = kto_ma[nr];
        if(nr == nr2)
            continue;
        if(bagaz[ktory[nr]] >= waga[nr] || bagaz[ktory[nr2]] >= waga[nr2])
        {
            printf("-1\n");
            return 0;
        }
        zamien(nr, nr2);
    }

    printf("%d\n", res.size());
    for(auto p : res)
    {
        printf("%d %d\n", p.ff, p.ss);
    }

    return 0;
}
