#C693. Toy Train: Removing Prime Railcars
Toy Train: Removing Prime Railcars
Toy Train: Removing Prime Railcars
You are given a toy train represented as a sequence of railcar labels. Each railcar is labeled with a positive integer. Your task is to remove all railcars whose labels are prime numbers. A number \(p\) is considered prime if it satisfies \(p > 1\) and has no divisors other than 1 and itself.
Input Format: The first line contains an integer \(T\) denoting the number of test cases. Each test case consists of two lines. The first line of each test case contains an integer \(n\), the number of railcars. The second line contains \(n\) space-separated integers, representing the labels of the railcars.
Output Format: For each test case, output a single line containing the labels of the railcars after removing all prime numbers, with each number separated by a space. If no railcar remains, output an empty line.
Note: Use the standard input (stdin) for reading input and standard output (stdout) for printing the result.
inputFormat
The input begins with an integer \(T\) indicating the number of test cases. For each test case, the first line contains an integer \(n\) representing the number of railcars. The following line contains \(n\) space-separated integers which are the railcar labels.
outputFormat
For each test case, output a single line that lists the railcar labels after removing the prime numbers. Numbers should be separated by a single space. If all railcars are removed, output an empty line.
## sample4
6
4 5 6 7 8 10
3
2 3 4
5
11 13 17 19 1
1
0
4 6 8 10
4
1
0
</p>