#include
#include
typedef struct HQ{
int a;
int b;
int c;
int d;
}hq;
int main()
{
int x;
int y;
int n;
int i;
int count1 = 0, count2 = 0;
hq h[100];
scanf("%d %d", &x, &y);
scanf("%d", &n);
for(i = 0; i < n; i++)
{
scanf("%d %d %d %d", &h[i].a, &h[i].b, &h[i].c, &h[i].d);
}
for(i = 0; i < n; i++)
{
if(h[i].b == h[i].a+h[i].c && h[i].d != h[i].a+h[i].c)
{
count1++;
if(count1 == x+1)
{
printf("A\n%d\n", count2);
return 0;
}
}
if(h[i].d == h[i].a+h[i].c && h[i].b != h[i].a+h[i].c)
{
count2++;
if(count2 == y+1)
{
printf("B\n%d\n", count1);
return 0;
}
}
}
return 0;
}
来源: http://www.bubuko.com/infodetail-1984629.html