`import java.util.Scanner;
public class TT019 {
public static void main(String[] args) {
int cups_A = 0,cups_B = 0;//定义甲乙两人喝的杯数分别为AB
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();//依次输入甲乙的酒量
int b = sc.nextInt();
int l = sc.nextInt();//输入游戏局数
for(;l>0;l–) {
int aa = sc.nextInt();//甲喊
int ab = sc.nextInt();//甲划
int bb = sc.nextInt();//乙喊
int ba = sc.nextInt();//乙划
if (ab == aa + bb && ba != aa + bb) {//甲成立甲喝一杯
cups_A++;
aa=ab=ba=bb=0;//每次置零
} else if (ab != aa + bb && ba == aa + bb) {//乙成立乙喝一杯
cups_B++;
aa=ab=ba=bb=0;
}
if (cups_A > a) {//甲喝多了
System.out.println(“A”);
System.out.println(cups_B);
break;
}
if (cups_B >b) {//乙喝多了
System.out.println(“B”);
System.out.println(cups_A);
break;
}
}
}
}