#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

bool check_asc(int* arr, size_t size)
{
    for (int i = 1; i < size; ++i)
    {
        if (arr[i] < arr[i - 1])
        {
            return false;
        }
    }
    return true;
}

bool check_desc(int* arr, size_t size)
{
    for (int i = 1; i < size; ++i)
    {
        if (arr[i] > arr[i - 1])
        {
            return false;
        }
    }
    return true;
}

int main(void)
{

    int n;
    scanf("%d", &n);
    int arr[(size_t)1e5];

    if (n == 1 || n == 2) {
        printf("reject\n");
        return 0;
    }

    for (int i = 0; i < n; i++)
    {
        (void)scanf("%d", &arr[i]);
    }

    bool asc = check_asc(arr, n);
    bool desc = check_desc(arr, n);
    if (asc && desc)
    {
        printf("reject\n");
        return 0;
    }

    if (asc)
    {
        for (int i = 0; i < n - 1; ++i)
        {
            if (arr[i] < arr[i + 1])
            {
                int tmp = arr[i];
                arr[i] = arr[i + 1];
                arr[i + 1] = tmp;
                break;
            }
        }
    }

    if (desc)
    {
        for (int i = 0; i < n - 1; ++i)
        {
            if (arr[i] > arr[i + 1])
            {
                int tmp = arr[i];
                arr[i] = arr[i + 1];
                arr[i + 1] = tmp;
                break;
            }
        }
    }

    for (int i = 0; i < n; ++i)
    {
        printf("%d\n", arr[i]);
    }

    return 0;
}
