#include using namespace std; #define ll long long vector rott(vector a) { vector res(3, string(3, ' ')); for (int i = 0; i < 3; ++ i) { for (int j = 0; j < 3; ++ j) { res[i][j] = a[2-j][i]; } } return res; } ll check(vector res) { if (res[0] == ":::" && res[1] == ":o:" && res[2] == ":::") return 1; if (res[0] == "::o" && res[1] == ":::" && res[2] == "o::") return 2; if (res[0] == "::o" && res[1] == ":o:" && res[2] == "o::") return 3; if (res[0] == "o:o" && res[1] == ":::" && res[2] == "o:o") return 4; if (res[0] == "o:o" && res[1] == ":o:" && res[2] == "o:o") return 5; if (res[0] == "o:o" && res[1] == "o:o" && res[2] == "o:o") return 6; return -1; } int main() { vector a(3); ll res = -1; cin >> a[0]; cin >> a[1]; cin >> a[2]; for (int i = 0; i < 5; ++ i) { res = max(res, check(a)); vector b = rott(a); //cout << b[0].size() << endl; a = b; } if (res != -1) cout << res; else cout << "unknown"; cout << endl; return 0; }