checked Inputting 1 2 3 in different orders, program is working correctly
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 a = new BufferedReader (new InputStreamReader (System.in));
int b = Integer.parseInt(a.readLine());
int c = Integer.parseInt(a.readLine());
int d = Integer.parseInt(a.readLine());
if ((b<=c && b>=d) || (b>=c && b<=d))
System.out.println(b);
else if ((c<=b && c>=d) || (c>=b && c<=d))
System.out.println(c);
else
System.out.println(d);
}
}