import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Die {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String l = br.readLine();
        String l2 = br.readLine();
        String l3 = br.readLine();

        String[][] dies = new String[12][3];
        dies[0] = new String[]{":::",":o:",":::"};
        dies[1] = new String[]{":::",":o:",":::"};
        dies[2] = new String[]{"::o",":::","o::"};
        dies[3] = new String[]{"o::",":::","::o"};
        dies[4] = new String[]{"o::",":o:","::o"};
        dies[5] = new String[]{"::o",":o:","o::"};
        dies[6] = new String[]{"o:o",":::","o:o"};
        dies[7] = new String[]{"o:o",":::","o:o"};
        dies[8] = new String[]{"o:o",":o:","o:o"};
        dies[9] = new String[]{"o:o",":o:","o:o"};
        dies[10] = new String[]{"ooo",":::","ooo"};
        dies[11] = new String[]{"o:o","o:o","o:o"};

        boolean f = false;
        for (int i = 0; i < 12; i++) {
            if (
                    l.equals(dies[i][0]) &&
                    l2.equals(dies[i][1]) &&
                    l3.equals(dies[i][2])
                    ) {

                f = true;
                System.out.println((i/2)+1);
                break;
            }
        }
        if (!f) {
            System.out.println("unknown");
        }

        br.close();
    }
}
