let count = 0;
function printStringIfExactlyTwoChars(str) {
const uniqueChars = new Set(str.split(''));
for (const char of uniqueChars) {
if (str.split(char).length - 1 === 2) {
console.log(str);
return; // Exit the function after logging once
}
}
}
while (count < 8) {
const str = readline();
printStringIfExactlyTwoChars(str);
count++;
}
bGV0IGNvdW50ID0gMDsKCmZ1bmN0aW9uIHByaW50U3RyaW5nSWZFeGFjdGx5VHdvQ2hhcnMoc3RyKSB7CiAgICBjb25zdCB1bmlxdWVDaGFycyA9IG5ldyBTZXQoc3RyLnNwbGl0KCcnKSk7CiAgICBmb3IgKGNvbnN0IGNoYXIgb2YgdW5pcXVlQ2hhcnMpIHsKICAgICAgICBpZiAoc3RyLnNwbGl0KGNoYXIpLmxlbmd0aCAtIDEgPT09IDIpIHsKICAgICAgICAgICAgY29uc29sZS5sb2coc3RyKTsKICAgICAgICAgICAgcmV0dXJuOyAvLyBFeGl0IHRoZSBmdW5jdGlvbiBhZnRlciBsb2dnaW5nIG9uY2UKICAgICAgICB9CiAgICB9Cn0KCndoaWxlIChjb3VudCA8IDgpIHsKICAgIGNvbnN0IHN0ciA9IHJlYWRsaW5lKCk7CiAgICBwcmludFN0cmluZ0lmRXhhY3RseVR3b0NoYXJzKHN0cik7CiAgICBjb3VudCsrOwp9