#include #include using namespace std; int main() { string name[2]; int yp[2]; char h[2]; for (int i = 0; i < 2; i++) { cin >> name[i] >> yp[i] >> h[i]; } if ((h[0] == 'R' && h[1] == 'P') || (h[0] == 'C' && h[1] == 'R') || (h[0] == 'P' && h[1] == 'C')) { if (yp[0] > yp[1]) { cout << name[0] << endl; } else cout << name[1] << endl; } else if ((h[0] == 'R' && h[1] == 'C') || (h[0] == 'C' && h[1] == 'P') || (h[0] == 'P' && h[1] == 'R')) { if (yp[0] < yp[1]) { cout << name[1] << endl; } else cout << name[0] << endl; } else { if (yp[0] < yp[1]) { cout << name[1] << endl; } else if (yp[0] > yp[1]) { cout << name[0] << endl; } else { cout << "-1" << endl; } } return 0; }