```
```

package com.codegym.task.task04.task0441;
/*
Somehow average
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String x = reader.readLine();
String y = reader.readLine();
String z = reader.readLine();
int a = Integer.parseInt(x);
int b = Integer.parseInt(y);
int c = Integer.parseInt(z);
if((a > b && c > b) || (b > a && c > a))
{
if(a >= b && b <= c)
{
System.out.println(b);
}
else if(a >= c && b >= c)
{
System.out.println(c);
}
else
{
System.out.println(a);
}
}
else
{
System.out.println(c);
}
}
}

max(max(a,b),c)andmin(min(a,b),c)if(a > b) swap a and bif(b > c) swap b and cif(a > b) swap a and b<--- this is needed again in case and and c swapSys.out(b)<--- b will satisfy all conditions at this point; if all numebrs are the same, if 2 numbers are the same, or will be the middle number if they are all different. Here is a link with code you can use, look specifically for the "Book's Solution" about midway down: https://codereview.stackexchange.com/questions/38247/inputting-and-sorting-three-integers