#include char dice[8][3][4] = { { ":::", ":o:", ":::" }, { "::o", ":::", "o::" }, { "::o", ":o:", "o::" }, { "o:o", ":::", "o:o" }, { "o:o", ":o:", "o:o" }, { "o:o", "o:o", "o:o" }, { "o::", ":::", "::o" }, { "o::", ":o:", "::o" } }; int main() { char die[3][5]; for(int i=0; i<3; i++){ fgets(die[i], 5, stdin); die[i][4] = 0; } bool br = false; int res = 0; for(int d=0;d<8;d++){ br = false; for(int i=0;i<3;i++){ for(int j = 0; j < 3 ;j++){ if(die[i][j] != dice[d][i][j]){ br = true; break; } else if (i ==2 && j == 2){ res = d+1; goto ending; } } if(br)break; } br = false; for(int i=0;i<3;i++){ for(int j = 2; j >=0 ;j--){ if(die[i][j] != dice[d][i][j]){ br = true; break; } else if (i ==2 && j == 0){ res = d+1; goto ending; } } if(br)break; } } ending: if (res > 6) res-=5; if(res > 0) { printf("%d\n",res); } else{ printf("unknown\n"); } return 0; }