#include<bits/stdc++.h>
using namespace std;

#define x first
#define y second
using Point = pair<int, int>;

using Direction = int;
using Body = vector<Direction>;

struct Snake {
  Point head;
  Body body;
  bool operator<(auto s) const {return head != s.head ? head < s.head : body < s.body;}
};

const int D = 7;
const Direction DX[D] = {0,  0,  1, 1, 0, -1, -1};
const Direction DY[D] = {0, -1, -1, 0, 1,  1,  0};

bool valid(const Body& body) {
  static map<Body, bool> memo;
  if(memo.count(body)) return memo[body];
  const int N = 10;
  auto x = N, y = N;
  vector<vector<int>> f(2*N, vector<int>(2*N));
  for(auto d = 0; d < D; ++d) ++f[x+DX[d]][y+DY[d]];
  for(auto b: body) {
    x += DX[b];
    y += DY[b];
    for(auto d = 0; d < D; ++d) ++f[x+DX[d]][y+DY[d]];
  }
  x = y = N;
  if(f[x][y] != 2) return memo[body] = false;
  for(auto i = 0; i < body.size(); ++i) {
    x += DX[body[i]];
    y += DY[body[i]];
    if(i == body.size() - 1) {
      if(f[x][y] != 2) return memo[body] = false;
    } else {
      if(f[x][y] != 3) return memo[body] = false;
    }
  }
  return memo[body] = true;
}

Direction direction(const Point& p) {
  static map<Point, Direction> memo;
  if(memo.count(p)) return memo[p];
  for(auto d = 1; d < D; ++d) if(p.x == DX[d] && p.y == DY[d]) return memo[p] = d;
  return -1;
}

void next(vector<Snake>& res, vector<Point>& point, int depth, bool moved) {
  if(depth == point.size()) {
    Snake snake;
    snake.head = point[0];
    for(auto i = 1; i < point.size(); ++i) snake.body.emplace_back(direction(Point(point[i].x - point[i-1].x, point[i].y - point[i-1].y)));
    if(valid(snake.body)) res.emplace_back(snake);
    return;
  }
  next(res, point, depth + 1, false);
  if(moved) return;
  for(auto d = 1; d < D; ++d) {
    point[depth].x += DX[d];
    point[depth].y += DY[d];
    if(depth == 0 || direction(Point(point[depth].x - point[depth-1].x, point[depth].y - point[depth-1].y)) != -1)
      next(res, point, depth + 1, true);
    point[depth].x -= DX[d];
    point[depth].y -= DY[d];
  }
}

vector<Snake> next(const Snake& snake) {
  static map<Body, vector<Snake>> memo;
  if(memo.count(snake.body)) return memo[snake.body];
  vector<Point> point;
  point.emplace_back(0, 0);
  for(auto i = 0; i < snake.body.size(); ++i) {
    auto b = snake.body[i];
    auto x = point.back().x + DX[b];
    auto y = point.back().y + DY[b];
    point.emplace_back(x, y);
  }
  next(memo[snake.body], point, 0, false);
  return memo[snake.body];
}

set<Point> terrain(auto k, const auto& u, const auto& v) {
  set<Point> res;
  for(auto i = 0; i < k; ++i) res.emplace(u[i], v[i]);
  return res;
}

int solve(const auto& snake, const auto& rock, auto X, auto Y) {
  set<Snake> visited;
  queue<pair<int, Snake>> q;
  q.emplace(0, snake);
  while(!q.empty()) {
    int step;
    Snake cur;
    tie(step, cur) = q.front();
    q.pop();
    if(cur.head.x == X && cur.head.y == Y) return step;
    if(20-step < abs(X-cur.head.x)) continue;
    if(20-step < abs(Y-cur.head.y)) continue;
    if(visited.count(cur)) continue;
    visited.emplace(cur);
    for(auto nex: next(cur)) {
      nex.head.x += cur.head.x;
      nex.head.y += cur.head.y;
      auto p = nex.head;
      bool stranding = rock.count(p);
      for(auto b: nex.body) {
        p.x += DX[b];
        p.y += DY[b];
        stranding |= rock.count(p);
      }
      if(stranding) continue;
      if(!visited.count(nex)) q.emplace(step + 1, nex);
    }
  }
  assert(false);
}

int main() {
  int n;
  while(cin >> n, n) {
    vector<int> x(n), y(n);
    for(auto i = 0; i < n; ++i) cin >> x[i] >> y[i];
    int k;
    cin >> k;
    vector<int> u(k), v(k);
    for(auto i = 0; i < k; ++i) cin >> u[i] >> v[i];
    int X, Y;
    cin >> X >> Y;

    for(auto p: {&x, &y, &u, &v}) for(auto& i: *p) i += 1e6;
    for(auto p: {&X, &Y}) *p += 1e6;

    Snake snake;
    snake.head = {x[0], y[0]};
    for(auto i = 1; i < n; ++i) snake.body.emplace_back(direction({x[i] - x[i-1], y[i] - y[i-1]}));

    cout << solve(snake, terrain(k, u, v), X, Y) << endl;
  }
}

Measured memory_bytes: 51076