//用二分匹配求出最大的匹配数
//然后任意删除一条边
//如果再次求得的最大匹配不是原来的值
//那么该边就是这个最大匹配的唯一边
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int maxn = 110;
int line[maxn][maxn];
int match[maxn];
int vis[maxn];
int N;
int hash[maxn];
struct node
{
int xmi,xma,ymi,yma;
}slide[maxn];
int find(int start)
{
for(int i = 1;i <= N;i++)
{
if(!vis[i]&&line[start][i])
{
vis[i] = 1;
if(match[i] == -1 || find(match[i]))
{
match[i] = start;
return 1;
}
}
}
return 0;
}
int Match()
{
memset(match, -1 , sizeof(match));
int ans=0;
for(int i = 1;i <= N;i++)
{
memset(vis,0,sizeof(vis));
if(find(i))
ans++;
}
return ans;
}
int main()
{
//freopen("in.txt","r",stdin);
int i,j, cas = 0;
while(scanf("%d", &N)&&N)
{
memset(line, 0 ,sizeof(line));
for(i = 1; i <= N ;i++)
scanf("%d%d%d%d",&slide[i].xmi,&slide[i].xma,&slide[i].ymi,&slide[i].yma);
for(i =1; i <= N;i++)
{
int x,y;
scanf("%d%d",&x,&y);
for(j = 1; j <= N;j++)
if(x>slide[j].xmi&&x<slide[j].xma&&y>slide[j].ymi&&y<slide[j].yma)
line[i][j] = 1;
}
int sum = Match();
int flag = 0;
printf("Heap %d\n", ++cas);
for(j = 1; j <= N ;j++)
for( i = 1; i <= N ;i++)
if(line[i][j])
{
line[i][j] = 0;
if(sum != Match() && !hash[i])
{
if(flag)
printf(" ");
else
flag = 1;
printf("(%c,%d)",j-1+'A', i);
vis[i] = 1;
}
line[i][j] = 1;
}
if(!flag)
printf("none");
puts("");
puts("");
}
}