#include <iostream>
#include <cstdio>
using namespace std;

int main(){
	char o1, o2;
	int a = 1, b = 0, c = 0;
	int i = 0;
	while(1){//scanf("%c,%c", &o1, &o2) != EOF){
		char q;
		cin >> o1 >> q >> o2;
		int *p1, *p2;
		if(o1 == '0') break;
		else if(o1 == 'A') p1 = &a;
		else if(o1 == 'B') p1 = &b;
		else if(o1 == 'C') p1 = &c;

		if(o2 == 'A') p2 = &a;
		else if(o2 == 'B') p2 = &b;
		else if(o2 == 'C') p2 = &c;

		if(p1 != p2){
			int s = *p1;
			*p1 = *p2;
			*p2 = s;
		}
		cout << i << '/'<< a <<  ' ' << b << ' ' << c << endl;
		i++;
	}

	if(a == 1) cout << 'A' << endl;
	if(b == 1) cout << 'B' << endl;
	if(c == 1) cout << 'C' << endl;

	return 0;
}