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

#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<endl)

struct DUMP : ostringstream {
	template<class T> DUMP &operator,(const T &t) {
		if(this->tellp()) *this << ", ";
		*this << t;
		return *this;
	}
};

template<class T> inline void chmax(T &a, const T &b) { if(b > a) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(b < a) a = b; }

template<class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
	return os << '(' << p.first << ", " << p.second << ')';
}

template<class Tuple, unsigned Index>
void print_tuple(ostream &os, const Tuple &t) {}

template<class Tuple, unsigned Index, class Type, class... Types>
void print_tuple(ostream &os, const Tuple &t) {
	if(Index) os << ", ";
	os << get<Index>(t);
	print_tuple<Tuple, Index + 1, Types...>(os, t);
}

template<class... Types>
ostream &operator<<(ostream &os, const tuple<Types...> &t) {
	os << '(';
	print_tuple<tuple<Types...>, 0, Types...>(os, t);
	return os << ')';
}

template<class Iterator>
ostream &dump_range(ostream &, Iterator, const Iterator &);

template<class T>
ostream &operator<<(ostream &os, const vector<T> &c) {
	return dump_range(os, c.cbegin(), c.cend());
}

template<class Iterator>
ostream &dump_range(ostream &os, Iterator first, const Iterator &last) {
	os << '[';
	for(int i = 0; first != last; ++i, ++first) {
		if(i) os << ", ";
		os << *first;
	}
	return os << ']';
}

struct state {
	int x, y, tail;
	state(int x_, int y_, int tail_):x(x_), y(y_), tail(tail_) {}
	bool operator<(const state &s) const {
		if(x != s.x) return x < s.x;
		if(y != s.y) return y < s.y;
		return tail < s.tail;
	}
};

typedef pair<int, int> point;
#define X first
#define Y second

point operator-(const point &a, const point &b) {
	return {a.first - b.first, a.second - b.second};
}

constexpr int dx[6] = {0, -1, -1, 0, 1, 1};
constexpr int dy[6] = {-1, 0, 1, 1, 0, -1};
map<point, int> get_d;

int n;
int gx, gy;
set<point> rocks;

constexpr int mask = (1 << 3) - 1;

inline void init() {
	for(int d = 0; d < 6; ++d) {
		get_d[point(dx[d], dy[d])] = d;
	}
}

inline int encode(const vector<point> &hexerpents) {
	for(unsigned i = 0; i < hexerpents.size(); ++i) {
		for(unsigned j = i + 2; j < hexerpents.size(); ++j) {
			assert(!get_d.count(hexerpents[i] - hexerpents[j]));
			assert(hexerpents[i] != hexerpents[j]);
		}
	}

	int res = 0;
	for(unsigned i = hexerpents.size() - 1; i > 0; --i) {
		assert(get_d.count(hexerpents[i] - hexerpents[i - 1]));
		res = (res << 3) | get_d[hexerpents[i] - hexerpents[i - 1]];
	}
	return res;
}

inline vector<point> decode(int hx, int hy, int tail) {
	vector<point> res{{hx, hy}};
	res.reserve(n);

	for(int i = 1; i < n; ++i) {
		const int d = tail & mask;
		tail >>= 3;
		hx += dx[d];
		hy += dy[d];
		res.emplace_back(hx, hy);
	}

	return res;
}

inline bool ok(int idx, const vector<point> &hexerpents) {
	if(idx && !get_d.count(hexerpents[idx] - hexerpents[idx - 1])) return false;
	if(idx < n - 1 && !get_d.count(hexerpents[idx] - hexerpents[idx + 1])) return false;
	for(int i = 0; i < idx - 1; ++i) {
		if(get_d.count(hexerpents[i] - hexerpents[idx]) || hexerpents[i] == hexerpents[idx]) return false;
	}

	return true;
}

void update(int idx, vector<point> &hexerpents, int n_dist, queue<state> &que, map<state, int> &dist) {
	if(idx >= n) {
		if(!ok(n - 1, hexerpents)) return;
		const int code = encode(hexerpents);
		const state next(hexerpents[0].X, hexerpents[0].Y, code);
		assert(hexerpents == decode(next.x, next.y, code));
		if(!dist.count(next)) {
			que.push(next);
			dist[next] = n_dist;
		}
		return;
	}

	if(ok(idx, hexerpents)) update(idx + 1, hexerpents, n_dist, que, dist);
	point &p = hexerpents[idx];

	const int tx = p.X;
	const int ty = p.Y;
	for(int d = 0; d < 6; ++d) {
		p.X = tx + dx[d];
		p.Y = ty + dy[d];

		if(rocks.count(p)) continue;
		if(ok(idx, hexerpents)) update(idx + 2, hexerpents, n_dist, que, dist);
	}
	p.X = tx;
	p.Y = ty;
}

int bfs(const state &start) {
	queue<state> que;
	que.push(start);
	map<state, int> dist;
	dist[start] = 0;

	while(!que.empty()) {
		const state current = que.front();
		que.pop();

		assert(dist.count(current) && dist[current] <= 20);

		if(current.x == gx && current.y == gy) return dist[current];

		auto hexerpents = decode(current.x, current.y, current.tail);
		update(0, hexerpents, dist[current] + 1, que, dist);
	}
	assert(false);
}

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	init();

	while(cin >> n && n) {
		vector<point> hexerpents;
		hexerpents.reserve(n);
		for(int i = 0; i < n; ++i) {
			int x, y;
			cin >> x >> y;
			hexerpents.emplace_back(x, y);
		}

		const state start(hexerpents[0].X, hexerpents[0].Y, encode(hexerpents));

		int k;
		cin >> k;

		rocks.clear();
		for(int i = 0; i < k; ++i) {
			int u, v;
			cin >> u >> v;
			rocks.insert({u, v});
		}

		cin >> gx >> gy;
		cout << bfs(start) << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 14332