import java.util.*; public class Antti { static boolean check(long[] a) { for (int i = 0; i < a.length-1; i++) { if (a[i] > a[i+1]) return true; } return false; } public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); long[] a = new long[n]; for (int i = 0; i < n; i++) a[i] = input.nextLong(); for (int i = 0; i < n; i++) { long value = a[i]; char[] digits = (""+a[i]).toCharArray(); for (int j = 0; j < digits.length; j++) { char old = digits[j]; char s = digits.length == 1 ? '0' : '1'; for (char k = s; k <= '9'; k++) { digits[j] = k; a[i] = Long.parseLong(new String(digits)); if (check(a)) { for (int h = 0; h < n; h++) { System.out.print(a[h]+" "); } System.out.println(); return; } } digits[j] = old; } a[i] = value; } System.out.println("impossible"); } }