#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vint;
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
int dx[]={0,1,1,0,-1,-1,0};
int dy[]={-1,-1,0,1,1,0,0};
int n;
queue<vector<pii>> tmp;
vector<pii> t;
pii goal;
set<pii> rock;
typedef unsigned long long ull;
set<ull> used;
ull seed=1145148931919;
bool check2(pii &a,pii &b){
    if(a==b) return false;
    if(a.F==b.F&&abs(a.S-b.S)==1) return false;
    if(a.S==b.S&&abs(a.F-b.F)==1) return false;
    if(a.F+1==b.F&&a.S-1==b.S) return false;
    if(a.F-1==b.F&&a.S+1==b.S) return false;
    return true;
}
bool check3(pii &a,pii &b){
    if(a==b) return false;
    if(a.F==b.F&&abs(a.S-b.S)==1) return true;
    if(a.S==b.S&&abs(a.F-b.F)==1) return true;
    if(a.F+1==b.F&&a.S-1==b.S) return true;
    if(a.F-1==b.F&&a.S+1==b.S) return true;
    return false;
}
bool check(vector<pii> &a,int b){
    rep(i,b-1){
        if(!check2(a[i],a[b])) return false;
    }
    if(b){
        if(!check3(a[b],a[b-1])) return false;
    }
    if(b!=n-1){
        if(!check3(a[b],a[b+1])) return false;
    }
    if(rock.find(a[b])!=rock.end()) return false;
    return true;
}
int dist(pii &a,pii &b){
    return abs(a.F-b.F)+abs(a.S-b.S);
}
ull has(vector<pii> &a){
    ull ret=0;
    ull t=1;
    rep(i,a.size()){
        ret+=a[i].F*t;
        t*=seed;
        ret+=a[i].S*t;
        t*=seed;
    }
    return ret;
}
void foo(int a,int b,vector<pii> &c,int d){
    if(a==n){
        if(d) tmp.push(c);
        return;
    }
    if(b==0){
        if(check(c,a)) foo(a+1,1,c,d);
        return;
    }
    if(check(c,a)) foo(a+1,1,c,d);
    rep(i,6){
        c[a].F+=dx[i];
        c[a].S+=dy[i];
        if(check(c,a)) foo(a+1,0,c,d+1);
        c[a].F-=dx[i];
        c[a].S-=dy[i];
    }
    return;
}
void mainmain(){
    while(cin>>n){
        if(n==0) return;
        vector<pii> in(n);
        rep(i,n) cin>>in[i].F>>in[i].S;
        int K;
        cin>>K;
        rock.clear();
        used.clear();
        rep(i,K){
            int a,b;
            cin>>a>>b;
            rock.insert(pii(a,b));
        }
        cin>>goal.F>>goal.S;
        queue<vector<pii>> q;
        used.insert(has(in));
        q.push(in);
        int ans=1;
        bool f=false;
        while(1){
            int qs=q.size();
            rep(i,qs){
                vector<pii> top=q.front();
                q.pop();
                foo(0,1,top,0);
            }
            vector<vector<pii>> vv;
            while(!tmp.empty()){
                if(tmp.front()[0]==goal){
                    f=true;
                    auto tt=tmp.front();
                }
                vv.PB(tmp.front());
                tmp.pop();
            }
            sort(ALL(vv));
            vv.erase(unique(ALL(vv)),vv.end());
            rep(i,vv.size()){
                if(dist(vv[i][0],goal)>22-ans) continue;
                if(used.find(has(vv[i]))==used.end())q.push(vv[i]);
                used.insert(has(vv[i]));
            }
            if(f) break;
            ans++;
            if(ans>=21) break;
        }
        cout<<ans<<endl;
    }
}
signed main() {
    mainmain();
}

Measured memory_bytes: 27836