# 2022 Azerbaijan Round 1, 8-9-10-11 classes

# Lexicographically smallest cyclic shift

A permutation of order **n** is a sequence of pairwise distinct positive integers `p`

, _{1}`p`

, ..., _{2}`p`

, where each _{n}**1** ≤ `p`

≤ _{i}**n**. We say that the permutation `q`

, _{1}`q`

, ..., _{2}`q`

is lexicographically less than the permutation _{n}`p`

, _{1}`p`

, ..., _{2}`p`

if there is _{n}**i** such that `q`

< _{i}`p`

, and for any _{i}**j** < **i**`p`

= _{j}`q`

._{j}

A cyclic shift by **k** of a permutation `p`

, _{1}`p`

, ..., _{2}`p`

is the sequence _{n}`p`

, _{k+1}`p`

, ..., _{k+2}`p`

, _{n}`p`

, ..., _{1}`p`

. Note that any cyclic shift of a permutation is also a permutation._{k}

Find the lexicographically smallest cyclic shift of the given permutation.

#### Input

The first line contains the order **n** (**1** ≤ **n** ≤ `10`

) of the given permutation. The second line contains numbers ^{5}`p`

, _{1}`p`

, ..., _{2}`p`

._{n}

#### Output

Print the permutation that is the smallest lexicographically cyclic shift of the permutation given in the input. Use the same format as the permutation given in the second line of the input.

3 3 2 1

1 3 2