import java.io.*;
class Main {
char p1 = br.readLine().charAt(0);
char p2 = br.readLine().charAt(0);
switch(p1) {
case 'G':
if (p2 == 'G')
else if (p2 == 'C')
else if (p2 == 'P')
break;
case 'C':
if (p2 == 'G')
else if (p2 == 'C')
else if (p2 == 'P')
break;
case 'P':
if (p2 == 'G')
else if (p2 == 'C')
else if (p2 == 'P')
break;
default:
break;
}
}
}
aW1wb3J0IGphdmEuaW8uKjsKCmNsYXNzIE1haW4gewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgdGhyb3dzIElPRXhjZXB0aW9uIHsKCQlCdWZmZXJlZFJlYWRlciBiciA9IG5ldyBCdWZmZXJlZFJlYWRlcihuZXcgSW5wdXRTdHJlYW1SZWFkZXIoU3lzdGVtLmluKSk7CgkJCgkJY2hhciBwMSA9IGJyLnJlYWRMaW5lKCkuY2hhckF0KDApOwoJCWNoYXIgcDIgPSBici5yZWFkTGluZSgpLmNoYXJBdCgwKTsKCQkKCQlzd2l0Y2gocDEpIHsKCQljYXNlICdHJzogCgkJCWlmIChwMiA9PSAnRycpCgkJCQlTeXN0ZW0ub3V0LnByaW50bG4oIuW8leOBjeWIhuOBkSIpOwoJCQllbHNlIGlmIChwMiA9PSAnQycpCgkJCQlTeXN0ZW0ub3V0LnByaW50bG4oIlAx44Gu5Yud44GhIik7CgkJCWVsc2UgaWYgKHAyID09ICdQJykKCQkJCVN5c3RlbS5vdXQucHJpbnRsbigiUDLjga7li53jgaEiKTsKCQkJYnJlYWs7CgkJY2FzZSAnQyc6CgkJCWlmIChwMiA9PSAnRycpCgkJCQlTeXN0ZW0ub3V0LnByaW50bG4oIlAy44Gu5Yud44GhIik7CgkJCWVsc2UgaWYgKHAyID09ICdDJykKCQkJCVN5c3RlbS5vdXQucHJpbnRsbigi5byV44GN5YiG44GRIik7CgkJCWVsc2UgaWYgKHAyID09ICdQJykKCQkJCVN5c3RlbS5vdXQucHJpbnRsbigiUDHjga7li53jgaEiKTsKCQ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