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

/**
 *
 * @author tym3
 */
public class Die {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
   
    static String[][][] templ = {null,{{
        ":::",
        ":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"
    }}};
    
    public static void main(String[] args) throws IOException {
        String[] die = new String[]{br.readLine(), br.readLine(), br.readLine()};
        
        for (int x = 1; x <= 6; ++x) {
            String[][] template = templ[x];
            for (int y = 0; y < template.length; ++y) {
                String[] t = template[y];
                boolean ok = 
                    t[0].equals(die[0]) &&
                    t[1].equals(die[1]) && 
                    t[2].equals(die[2]);
                if (ok) {
                    System.out.println(x);
                    return;
                }
            }
        }
        System.out.println("unknown");
    }
    
}
