I check step to step the solution also with paper but the system return error. Why?
package com.codegym.task.task04.task0420;
/*
Sorting three numbers
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int x = Integer.parseInt(reader.readLine());
int y = Integer.parseInt(reader.readLine());
int z = Integer.parseInt(reader.readLine());
int first;
int second;
int third;
if (x > y && x > z) {
first = x;
} else if(x > y && x < z) {
second = x;
} else {
third = x;
}
if (y > x && y > z) {
first = y;
} else if(y > x && y < z) {
second = y;
} else {
third = y;
}
if (z > x && z > y) {
first = z;
} else if(z > x && z < y) {
second = z;
} else {
third = z;
}
System.out.println(first + " " + second + " " + third);
}
}