public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        int q = scn.nextInt();
        for (int i = 1; i <= q; i++) {
            int a = scn.nextInt();
            int b = scn.nextInt();
            int c = scn.nextInt();

            System.out.println("Case "
                    + i
                    + ": "
                    + ((b < a && a < c) || (c < a && a < b) ? a
                            : ((a < b && b < c) || (c < b && b < a) ? b : c)));
        }
    }