#include <iostream>
#include <map>
using namespace std;
int main() {
  char x, y, commma;
  string a[3] = {"A", "B", "C"};
  map<string, bool> mp;
  map<string, bool>::iterator itr;
  mp[a[0]] = 1;
  mp[a[1]] = 0;
  mp[a[2]] = 0;
  
  while(cin >> x >> commma >> y) {
	swap(mp[&x], mp[&y]);
	cout << "swap:" << mp[&x] << " " <<  mp[&y] << endl;
  }
  for(itr = mp.begin(); itr != mp.end(); ++itr) {
	if(itr->second) {
	  cout << itr->first << endl;
	}
  }
  return 0;
}