## DMOPC '21 Contest 5 P2 - Permutations & Primes

View as PDF

Points: 7
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

Given an integer , find any permutation of such that is not prime for every integer , or report that no such permutation exists.

#### Input Specification

The first and only line of input contains a single integer .

#### Output Specification

If there exists no valid permutation, output on a line by itself.

Otherwise, output space-separated integers on a single line, representing a permutation of where no prefix sum is prime.

#### Sample Input

5

#### Sample Output

4 5 3 2 1

#### Explanation

The prefix sums are: , , , , and .

None of , , , , or are prime, so this is a valid permutation.