#include <iostream>
using namespace std;
const int MAX_SIZE = 3;
void outputWinner(int players[], int notComplete) {
if (players[0] != players[1]) {
cout << "Jucătorul ";
if (players[0] > players[1]) {
cout << 0;
} else {
cout << 1;
}
} else if (notComplete) {
cout << "Continuă";
} else {
cout << "Egal";
}
}
void lineCheck (int players[], int firstNum, int secondNum, int thirdNum) {
if (firstNum == 0 && secondNum == 0 && thirdNum == 0) {
++players[0];
} else if (firstNum == 1 && secondNum == 1 && thirdNum == 1) {
++players[1];
}
}
int main() {
int players[MAX_SIZE - 1] = {0};
int matrix[MAX_SIZE][MAX_SIZE], notComplete = 0;
for (int i = 0; i < MAX_SIZE; ++i) {
for (int j = 0; j < MAX_SIZE; ++j) {
cin >> matrix[i][j];
if (j == MAX_SIZE - 1) {
lineCheck(players, matrix[i][j], matrix[i][j - 1], matrix[i][j - 2]);
if (i == MAX_SIZE - 1) {
lineCheck(players, matrix[i][j], matrix[i - 1][j - 1], matrix[i - 2][j - 2]);
}
} else if (i == MAX_SIZE - 1) {
lineCheck(players, matrix[i][j], matrix[i - 1][j], matrix[i - 2][j]);
if (j == 0) {
lineCheck(players, matrix[i][j], matrix[i - 1][j + 1], matrix[i - 2][j + 2]);
}
}
if (matrix[i][j] == 2) {
notComplete = 1;
}
}
}
outputWinner(players, notComplete);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE1BWF9TSVpFID0gMzsKCnZvaWQgb3V0cHV0V2lubmVyKGludCBwbGF5ZXJzW10sIGludCBub3RDb21wbGV0ZSkgewogICAgaWYgKHBsYXllcnNbMF0gIT0gcGxheWVyc1sxXSkgewogICAgICAgIGNvdXQgPDwgIkp1Y8SDdG9ydWwgIjsKICAgICAgICBpZiAocGxheWVyc1swXSA+IHBsYXllcnNbMV0pIHsKICAgICAgICAgICAgY291dCA8PCAwOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGNvdXQgPDwgMTsKICAgICAgICB9CiAgICB9IGVsc2UgaWYgKG5vdENvbXBsZXRlKSB7CiAgICAgICAgY291dCA8PCAiQ29udGludcSDIjsgICAgICAgIAogICAgfSBlbHNlIHsKICAgICAgICBjb3V0IDw8ICJFZ2FsIjsKICAgIH0KfQoKdm9pZCBsaW5lQ2hlY2sgKGludCBwbGF5ZXJzW10sIGludCBmaXJzdE51bSwgaW50IHNlY29uZE51bSwgaW50IHRoaXJkTnVtKSB7CiAgICBpZiAoZmlyc3ROdW0gPT0gMCAmJiBzZWNvbmROdW0gPT0gMCAmJiB0aGlyZE51bSA9PSAwKSB7CiAgICAgICAgKytwbGF5ZXJzWzBdOwogICAgfSBlbHNlIGlmIChmaXJzdE51bSA9PSAxICYmIHNlY29uZE51bSA9PSAxICYmIHRoaXJkTnVtID09IDEpIHsKICAgICAgICArK3BsYXllcnNbMV07CiAgICB9Cn0KCmludCBtYWluKCkgewogICAgaW50IHBsYXllcnNbTUFYX1NJWkUgLSAxXSA9IHswfTsKICAgIGludCBtYXRyaXhbTUFYX1NJWkVdW01BWF9TSVpFXSwgbm90Q29tcGxldGUgPSAwOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBNQVhfU0laRTsgKytpKSB7CiAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCBNQVhfU0laRTsgKytqKSB7CiAgICAgICAgICAgIGNpbiA+PiBtYXRyaXhbaV1bal07CiAgICAgICAgICAgIGlmIChqID09IE1BWF9TSVpFIC0gMSkgewogICAgICAgICAgICAgICAgbGluZUNoZWNrKHBsYXllcnMsIG1hdHJpeFtpXVtqXSwgbWF0cml4W2ldW2ogLSAxXSwgbWF0cml4W2ldW2ogLSAyXSk7CiAgICAgICAgICAgICAgICBpZiAoaSA9PSBNQVhfU0laRSAtIDEpIHsKICAgICAgICAgICAgICAgICAgICBsaW5lQ2hlY2socGxheWVycywgbWF0cml4W2ldW2pdLCBtYXRyaXhbaSAtIDFdW2ogLSAxXSwgbWF0cml4W2kgLSAyXVtqIC0gMl0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9IGVsc2UgaWYgKGkgPT0gTUFYX1NJWkUgLSAxKSB7CiAgICAgICAgICAgICAgICBsaW5lQ2hlY2socGxheWVycywgbWF0cml4W2ldW2pdLCBtYXRyaXhbaSAtIDFdW2pdLCBtYXRyaXhbaSAtIDJdW2pdKTsKICAgICAgICAgICAgICAgIGlmIChqID09IDApIHsKICAgICAgICAgICAgICAgICAgICBsaW5lQ2hlY2socGxheWVycywgbWF0cml4W2ldW2pdLCBtYXRyaXhbaSAtIDFdW2ogKyAxXSwgbWF0cml4W2kgLSAyXVtqICsgMl0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChtYXRyaXhbaV1bal0gPT0gMikgewogICAgICAgICAgICAgICAgbm90Q29tcGxldGUgPSAxOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQogICAgb3V0cHV0V2lubmVyKHBsYXllcnMsIG5vdENvbXBsZXRlKTsKICAgIHJldHVybiAwOwp9