On a narrow one-way road, cars arrive one after the other. Each car has a speed value associated with it. Before letting them into the lane, all the cars must be arranged from the slowest to the fastest to maintain a smooth traffic flow. Your task is to sort these speed values in ascending order and display them. 



 Input Format

The first line contains an integer N represents the total number of cars waiting.
The next N lines each contain an integer  represents the speed value of each car in the order they arrived.


Output Format

Print the sorted speed values in a single line, separated by spaces.
If any of the inputs are invalid (like missing values, wrong data type, or out-of-range numbers), immediately print "Invalid input".


Constraints
import java.util.*;

public class CarSpeedSorter {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        // Read N
        if (!sc.hasNextInt()) {
            System.out.println("Invalid input");
            return;
        }
        int N = sc.nextInt();
        if (N < 1 || N > 100) {
            System.out.println("Invalid input");
            return;
        }

        int[] speeds = new int[N];
        for (int i = 0; i < N; i++) {
            if (!sc.hasNextInt()) { // missing or wrong datatype
                System.out.println("Invalid input");
                return;
            }
            int speed = sc.nextInt();
            if (speed < 0 || speed > 300) { // out of range
                System.out.println("Invalid input");
                return;
            }
            speeds[i] = speed;
        }

        // Sort speeds
        Arrays.sort(speeds);

        // Print sorted speeds
        for (int i = 0; i < N; i++) {
            System.out.print(speeds[i]);
            if (i < N - 1) System.out.print(" ");
        }
    }
}

1 ≤ N ≤ 100
0 ≤ speed ≤ 300
All speed values are whole numbers (integers) without any decimals.


Note:

Must determine the class with the name of CarSpeedSorter
Sample Input 1 :
5
50 20 70 10 30

Sample Output 1 :
10 20 30 50 70
Sample Input 2 :
6
0 300 150 300 0 150

Sample Output 2 :
0 0 150 150 300 300
Tab Switches:   N/A