#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=200005,INF=1<<30;

struct UF{
    int n;
    vector<int> par,size,edge;
    
    void init(int n_){
        n=n_;
        par.assign(n,-1);
        size.assign(n,1);
        edge.assign(n,0);
        
        for(int i=0;i<n;i++){
            par[i]=i;
        }
    }
    
    int root(int a){
        if(par[a]==a) return a;
        else return par[a]=root(par[a]);
    }
    
    void unite(int a,int b){
        edge[root(a)]++;
        if(root(a)!=root(b)){
            size[root(a)]+=size[root(b)];
            edge[root(a)]+=edge[root(b)];
            par[root(b)]=root(a);
        }
    }
    
    bool check(int a,int b){
        return root(a)==root(b);
    }
};

vector<int> S[MAX];
int from[MAX],to[MAX];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    vector<int> A(N),B(N),p(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    
    for(int i=0;i<N;i++){
        cin>>B[i];
    }
    
    UF uf;
    uf.init(N);
    
    bool ok=true;
    
    for(int i=0;i<N;i++){
        cin>>p[i];p[i]--;
        uf.unite(i,p[i]);
        
        if(A[i]<=B[p[i]]&&i!=p[i]) ok=false;
        
        to[i]=p[i];
        from[p[i]]=i;
    }
    
    if(!ok){
        cout<<-1<<endl;
        return 0;
    }
    
    for(int i=0;i<N;i++){
        if(uf.root(i)!=i) continue;
    }
    
    for(int i=0;i<N;i++) S[uf.root(i)].push_back(i);
    
    vector<pair<int,int>> ans;
    
    for(int i=0;i<N;i++){
        sort(all(S[i]),[&](auto a,auto b){
            return B[a]>B[b];
        });
        
        for(auto x:S[i]){
            if(from[x]==x) continue;
            ans.push_back(mp(from[x],x));
            
            int a=from[x],b=to[x];
            
            to[a]=b;
            from[b]=a;
            
            from[x]=x;
            to[x]=x;
        }
    }
    
    cout<<si(ans)<<endl;
    
    for(auto x:ans) cout<<x.fi+1<<" "<<x.se+1<<endl;
}


#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>
#include <tuple>

#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000000; //10^18
typedef long long ll;
typedef unsigned long long ull;


ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}

ll gcd(ll a, ll b) {
  if (a == 0 || b == 0) return a + b;
  if (b > a) return gcd(b, a);
  return gcd(b, a % b);
}




  



int main(void) {

  int n;
  int a[300];
  cin >> n;
  rep(i, n) cin >> a[i];
  rep(i, n) a[i] = a[i] % 200;

  int b[300] = {};

  rep(i, n) b[a[i]]++;

  rep(i, 200) {
    if (b[i] > 1) {
      cout << "Yes" << endl;
      int cnt = 0;
      rep(j, n) {
	if (a[j] == i) {
	  cout << 1 << " " << j+1 << endl;
	  cnt++;
	  if(cnt == 2) return 0;
	}
      }
    }
  }

  if (n >8) n = 8;
 
    int c[300] = {};
    for (int i = 1; i < (1 << n); i++) {
      int d = 0;
      rep(j, n) {
	if ((i>>j) & 1) {
	  d += a[j];
	}
      }
      d %= 200;
      c[d]++;
    }
    int q = 0, z;
    rep(i, 200) {
      if (c[i] > 1) {
	q++;
	z = i;
	break;
      }
    }
    if (q == 0) {
      cout << "No" << endl;
      return 0;
    }

    cout <<"Yes"<<endl;

    vector<int> w[3];
    int ur = 0;
    for (int i = 1; i < (1 << n); i++) {
      int d = 0;
      rep(j, n) {
	if ((i>>j) & 1) {
	  d += a[j];
	}
      }
      d %= 200;
      if (d == z) {
	
	rep(j, n) {
	  if ((i>>j) & 1) {
	    w[ur].push_back(j+1);
	  }
	}
	cout << w[ur].size() << " ";
	rep(j, w[ur].size()) cout << w[ur][j] << " ";
	cout << endl;
	ur++;
	if (ur == 2) return 0;
      }
    }

}

  

    
    
      
  
