#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef pair<vpii,int> P;

set<pii> iwa;
vpii tmp;
int dx[] = {-1,-1,0,0,0,1,1};
int dy[] = {0,1,-1,0,1,-1,0};
queue<vpii> Q;
set<vpii> visited;
map<pii, pair<pii, pii> > sumi;
map<pii, pair<pii, pii> > naka;

ostream &operator<<(ostream &stream, pair<int,int> p) {
  stream << "("<<p.first<<","<<p.second<<")";
  return stream;
}

void init() {
  sumi[pii(1,0)] = make_pair(pii(1,-1),pii(0,1));
  sumi[pii(1,-1)] = make_pair(pii(1,0),pii(0,-1));
  sumi[pii(0,-1)] = make_pair(pii(1,-1),pii(-1,0));
  sumi[pii(-1,0)] = make_pair(pii(0,-1),pii(-1,1));
  sumi[pii(-1,1)] = make_pair(pii(-1,0),pii(0,1));
  sumi[pii(0,1)] = make_pair(pii(-1,1),pii(1,0));
  naka[pii(2,-1)] = make_pair(pii(1,-1),pii(1,0));
  naka[pii(1,-2)] = make_pair(pii(1,-1),pii(0,-1));
  naka[pii(-1,-1)] = make_pair(pii(-1,0),pii(0,-1));
  naka[pii(-2,1)] = make_pair(pii(-1,0),pii(-1,1));
  naka[pii(-1,2)] = make_pair(pii(0,1),pii(-1,1));
  naka[pii(1,1)] = make_pair(pii(0,1),pii(1,0));
}

int n;

void move2(queue<P> &Q, int pos, bool mae, int dis) {
  if (pos) {                    // âªÈ¢©©é & üµÈ¢©©é
    if (iwa.count(tmp[pos-1])) return;
    REP(i, pos-2) {
      REP(j, 7) {
        int xx = tmp[i].first+ dx[j];
        int yy = tmp[i].second+dy[j];
        if (tmp[pos-1] == pii(xx,yy)) return;
      }
    }
  }
  // if (pos==n && tmp[n-1] == pii(1,-1)) {
  //   while(1);
  //   cout << tmp[0] << endl;
  // }

  pii now = tmp[pos];
  
  if (pos == n) {
    if (!visited.count(tmp))
      Q.push(P(tmp, dis));
    return;
  } else if (pos == 0 || pos == n-1) { // [
    move2(Q, pos+1, 0, dis);
    if (mae) return;
    int ddx,ddy;
    if (pos == 0) {
      ddx = tmp[1].first-tmp[0].first;
      ddy = tmp[1].second-tmp[0].second;
    } else {
      ddx = tmp[n-2].first-tmp[n-1].first;
      ddy = tmp[n-2].second-tmp[n-1].second;  
    }
    pii p[2];
    p[0] = sumi[pii(ddx,ddy)].first;
    p[1] = sumi[pii(ddx,ddy)].second;
    // if (pos==n-1 && tmp[0] == pii(1,-1)) {
    //   cout <<"skfjha" << tmp[pos] << " "  <<  p[0] << " " << p[1] << endl;
    // }
    
    REP(k,2) {
      tmp[pos] = pii(now.first + p[k].first, now.second + p[k].second);
      // if (pos==n-1 && tmp[0] == pii(1,-1))
      //    cout << tmp[pos] << endl;
      move2(Q, pos+1, 1, dis);
    }
    tmp[pos] = now;
  } else {                      // 
    move2(Q, pos+1,0,dis);
    if (mae) return;
    int ddx = tmp[pos+1].first-tmp[pos-1].first;
    int ddy = tmp[pos+1].second-tmp[pos-1].second;
    if (naka.count(pii(ddx,ddy))) {
      pair<pii, pii> hoge = naka[pii(ddx,ddy)];
      pii p[2];
      p[0] = pii(tmp[pos-1].first + hoge.first.first, tmp[pos-1].second+hoge.first.second);
      p[1] = pii(tmp[pos-1].first + hoge.second.first, tmp[pos-1].second+hoge.second.second);
      REP(k,2) {
        if (p[k] == tmp[pos]) continue;
        tmp[pos] = p[k];
        move2(Q, pos+1, 1, dis);
        tmp[pos] = now;
      }
    }
  }
}
void move(queue<P> &Q, vpii now, int dis) {
  tmp = now;
  move2(Q, 0,0, dis);
}

int main() {
  init();
  while(cin>>n,n){
    vector<pii> snake;
    REP(i,n) {
      int x,y; cin >> x >> y;
      snake.push_back(pii(x,y));
    }
    int k; cin >> k;
    iwa.clear();
    REP(i,k) {
      int x,y; cin >> x >> y;
      iwa.insert(pii(x,y));
    }
    int X,Y;cin >> X>>Y;

    queue<P> Q;
    visited.clear();
    Q.push(P(snake, 0));
    while(!Q.empty()) {
      vpii now = Q.front().first;
      int dis = Q.front().second;
      Q.pop();
      if (visited.count(now)) continue;
      visited.insert(now);
      // cout << dis << " " ;
      // REP(i,3)
      // printf("(%d,%d) ", now[i].first, now[i].second);
      // cout << endl;
      if (abs(now[0].first-X)+abs(now[0].second-Y) > 24-dis) continue;
      if (dis == 20 || now[0] == pii(X,Y)) {
        cout << dis << endl;
        break;
      }
      
      move(Q, now, dis+1);
    }
  }
}

Measured memory_bytes: 18000