#include <stdio.h>
int main ()
{
int t ,i ,j ,p , a [20000] ;
scanf ("%d",&t) ;
for (i=1 ;i<=t ;i++)
{
int max =1000 , min = 10000 ;
for (j=1 ; j<=3 ; j++)
{
scanf ("%d",&a [j] ) ;
if (max < a[j ] ) max = a[j] ;
if ( min > a[j]) min =a [j] ;
}
for (j=1 ; j<=3 ; j++)
{
if (a[j] != max && a[j] != min) p = a[j] ;
}
printf ("Case %d: %d\n",i ,p) ;
}
return 0 ;
}
int main ()
{
int t ,i ,j ,p , a [20000] ;
scanf ("%d",&t) ;
for (i=1 ;i<=t ;i++)
{
int max =1000 , min = 10000 ;
for (j=1 ; j<=3 ; j++)
{
scanf ("%d",&a [j] ) ;
if (max < a[j ] ) max = a[j] ;
if ( min > a[j]) min =a [j] ;
}
for (j=1 ; j<=3 ; j++)
{
if (a[j] != max && a[j] != min) p = a[j] ;
}
printf ("Case %d: %d\n",i ,p) ;
}
return 0 ;
}