#include<cstdio>#include<queue>#include<cstring>#include<cstdlib>using namespace std;const int maxn =21;int n,m,l,find,ans,move;bool map[maxn][maxn];int dx[]={1,-1,0,0};int dy[]={0,0,1,-1};bool vis[maxn][maxn][1<<14];bool check(int x,int y){ return x>=1&&x<=n&&y>=1&&y<=m; }struct node{ int head[2],tail[2]; bool map[maxn][maxn]; int step,val;}s_pos;void bfs(){ memset(vis,false,sizeof(vis)); queue<node > q; q.push(s_pos); vis[s_pos.head[0]][s_pos.head[1]][ s_pos.val] =true; while(!q.empty()){ node now = q.front(); q.pop(); if(now.head[0]==1&&now.head[1]==1){ find=1; ans=now.step; return ; } for(int i=0;i<4;i++){ node next = now; next.step+=1; int x=now.head[0]+dx[i]; int y=now.head[1]+dy[i]; if(check(x,y)){ if(next.map[x][y]) continue; next.head[0]=x; next.head[1]=y; next.map[x][y]=true; next.map[now.tail[0]][now.tail[1]]=false; int t= next.val&3; next.tail[0]=now.tail[0]+dx[t]; next.tail[1]=now.tail[1]+dy[t]; next.val=next.val>>2; int sum=i<<move; next.val+=sum; if(!vis[x][y][next.val]){ vis[x][y][next.val]=true; q.push(next); } } } }}int main(){ int t,x,y,ca=1; int nx[10],ny[10]; while(scanf("%d%d%d",&n,&m,&l)!=EOF,(n+m+l)){ memset(s_pos.map,false,sizeof(s_pos.map)); memset(map,false,sizeof(map)); s_pos.val=0; move=((l<<1)-4); for(int i=0;i<l;i++) { scanf("%d%d",&x,&y); nx[i]=x;ny[i]=y; s_pos.map[x][y]=true; if(i>0){ for(int j=0;j<4;j++){ if(x+dx[j]==nx[i-1]&&y+dy[j]==ny[i-1]){ s_pos.val=(s_pos.val<<2)+j; break; } } } } s_pos.head[0]=nx[0], s_pos.head[1]=ny[0]; s_pos.tail[0]=nx[l-1];s_pos.tail[1]=ny[l-1]; scanf("%d",&t); s_pos.step=0; for(int i=0;i<t;i++){ scanf("%d%d",&x,&y); map[x][y]=true; s_pos.map[x][y]=true; } find=0; bfs(); printf("Case %d: ",ca++); if(find){ printf("%dn",ans); } else printf("-1n"); } return 0;}