#include<iostream>
using namespace std;
int main()
{
char MaxNum(int a, int b, int c);
/*
* 输入格式:
输入第1行给出正整数N(<=105),即双方交锋的次数。随后N行,每行给出一次交锋的信息,即甲、乙双方同时给出的的手势。C代表“锤子”、J代表“剪刀”、B代表“布”,第1个字母代表甲方,第2个代表乙方,中间有1个空格。
输出格式:
输出第1、2行分别给出甲、乙的胜、平、负次数,数字间以1个空格分隔。第3行给出两个字母,分别代表甲、乙获胜次数最多的手势,中间有1个空格。如果解不唯一,则输出按字母序最小的解。
输入样例:
10
C J
J B
C B
B B
B C
C C
C B
J B
B C
J J
输出样例:
5 3 2
2 3 5
B B
*/
long count = 0;
cin >> count;
long arrAwin[3] = { 0 };
long countNumA[3] = { 0 };//B C J
long countNumB[3] = { 0 };//B C J
for (size_t i = 0; i < count; i++)
{
char A;
char B;
cin >> A;
cin >> B;
if ((A == 'C'&&B == 'J') || (A == 'J'&&B == 'B') || (A == 'B'&&B == 'C'))
{
arrAwin[0]++;
if (A == 'B')
{
countNumA[0]++;
}
if (A == 'C')
{
countNumA[1]++;
}
if (A == 'J')
{
countNumA[2]++;
}
}
//if ((A == 'C'&&B == 'C') || (A == 'J'&&B == 'J') || (A == 'B'&&B == 'B'))
if (A == B)
{
arrAwin[1]++;
}
if ((A == 'J'&&B == 'C') || (A == 'B'&&B == 'J') || (A == 'C'&&B == 'B'))
{
arrAwin[2]++;
if (B == 'B')
{
countNumB[0]++;
}
if (B == 'C')
{
countNumB[1]++;
}
if (B == 'J')
{
countNumB[2]++;
}
}
}
cout << arrAwin[0] << " " << arrAwin[1] << " " << arrAwin[2] << endl;
cout << arrAwin[2] << " " << arrAwin[1] << " " << arrAwin[0] << endl;
cout << MaxNum(countNumA[0], countNumA[1], countNumA[2]) << " " << MaxNum(countNumB[0], countNumB[1], countNumB[2]) << endl;
return 0;
}
char MaxNum(int a, int b, int c)
{
if (a >= b&&a >= c)
{
return 'B';
}
if (b >= a&&b >= c)
{
return 'C';
}
if (c >= a&&c >= b)
{
return 'J';
}
}