#include <bits/stdc++.h>
using namespace std;

int n;
char knj[1000005];

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; ++i)
    {
        cin >> knj[i];
    }
    for (int i = 0; i < n-1; ++i)
    {
        if (knj[i] < knj[i+1] || i == n-2)
        {
            swap(knj[i], knj[i+1]);
            break;
        }
    }
    for (int i = 0; i < n; ++i)
    {
        cout << knj[i] << " ";
    }
    return 0;
}