#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, j, n) for (int i = j; i < (n); ++i)
#define rrep(i, j, n) for (int i = (n)-1; j <= i; --i)

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T>& a) {
  os << "{";
  for (size_t i = 0; i < a.size(); ++i) os << (i > 0 ? "," : "") << a[i];
  return os << "}";
}

[[maybe_unused]] constexpr ll MOD = 1e9 + 7;
[[maybe_unused]] constexpr int INF = 0x3f3f3f3f;
[[maybe_unused]] constexpr ll INFL = 0x3f3f3f3f3f3f3f3fLL;

int main() {
  cin.tie(0)->sync_with_stdio(0);
  int n;
  cin >> n;
  vector<ll> a(n), b(n), p(n), q(n);
  vector<vector<int>> g(n);
  rep(i, 0, n) cin >> a[i];
  vector<pair<int, int>> ps;
  rep(i, 0, n) {
    cin >> b[i];
    ps.emplace_back(b[i], i);
  }
  sort(ps.rbegin(), ps.rend());

  rep(i, 0, n) {
    cin >> p[i], --p[i];
    q[p[i]] = i;
  }
  vector<pair<int, int>> ans;
  rep(i, 0, n) {
    // 重い荷物から完了させていく。
    // 重い荷物を渡しても、それがあってるならOK
    // 現在いるところと、
    auto [weight, bidx] = ps[i];
    if (p[bidx] != bidx) {
      int nowi = q[bidx]; // bidxを持っているa
      // bidx bを持たせたいa
      if (a[nowi] <= weight || a[bidx] <= b[p[bidx]]) {
        cout << -1 << '\n';
        return 0;
      }
      ans.emplace_back(nowi + 1, bidx + 1);
      swap(p[nowi], p[bidx]);
      q[p[nowi]] = nowi;
      q[p[bidx]] = bidx;
    }
  }
  cout << ans.size() << '\n';
  for (auto [x, y] : ans) cout << x << " " << y << '\n';

  return 0;
}
#include <bits/stdc++.h>
using namespace std; 
#define all(c) c.begin(),c.end()
#define sz(x) int(x.size())
#define ar array
typedef long long ll ; 
typedef vector<int> vi;
#define mod 1000000007
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll exp(ll x,ll y){
  x%=mod;
  ll res=1;
  while(y){
    if(y&1)
    res=res*x%mod;
    x=x*x%mod;
    y>>=1;
  }
  return res;
}
ll fact(ll n){
  ll res=1;
  for(ll i=2;i<=n;++i)
  (res*=i)%=mod;
  return res;
}
bool isprime(ll n){
  if(n<=1) return 0;
  for(ll i=2;i*i<=n;++i)
  if(n%i==0) return 0;
  return 1;
}

int main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n;
cin>>n;
set<int>s;
int mx=10000;
for(int i=2;i<=mx;++i){
  if(10*i<=mx)
  s.insert(10*i);
}
for(int i=2;i<=mx;++i){
  if(6*i<=mx)
  s.insert(6*i);
}
for(int i=2;i<=mx;++i){
  if(15*i<=mx)
  s.insert(15*i);
}
cout<<"10 6 15 ";
n-=3;
for(int i=1;i<=n;++i){
  cout<<*s.begin()<<" ";
  s.erase(s.begin());
}
return 0;
}
