Output correct then whats wrong here

question here: Contest Page | CodeChef

my answer:
/* package codechef; // don’t place package name! */

import java.util.;
import java.lang.
;
import java.io.*;
import java.lang.Math;

/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner in=new Scanner(System.in);
int a=in.nextInt();
int b=in.nextInt();
int c=in.nextInt();
int first_max=Math.max(a,b);
first_max=Math.min(c,first_max);
System.out.print(first_max);}}

this solution is correct for the given test cases…where c is either largest or second-largest but if we test it for a value like a=7 , b=6,c=2 then your answer according to your program will be 2 …which is wrong!