import java.io.*; class Main{ static final PrintWriter out=new PrintWriter(System.out); public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; while((line=br.readLine())!=null&&!line.isEmpty()){ int n=Integer.parseInt(line); char[] num=line.toCharArray(); boolean[] used=new boolean[10]; for(int i=0;i=1;i--){ if(!used[i]) continue; for(int j=0;j=i) continue; swap(j,rightNum(i,num),num); break loop; } } out.println(num); out.flush(); } } private static void swap(int a,int b,char[] num){ char c=num[a]; num[a]=num[b]; num[b]=c; } private static int rightNum(int a,char[] num){ for(int i=num.length-1;i>=0;i--){ if((int)(num[i]-'0')==a) return i; } return -1; } }