#include <bits/stdc++.h>
int x, a[1005];
bool check(int a, int b) {
  int ans = 0;
  while (a) {
    if (a % 10 != b % 10) ans += 1;
    a /= 10;
    b /= 10;
  }
  return ans <= 1;
}
int main() {
  int n;
  while (~scanf("%d", &n)) {
    int m = 1000, k = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &x);
      for (int j = m; j <= 2011; j++) {
        if (check(j, x)) {
          m = a[++k] = j;
          break;
        }
      }
    }
    if (k == n)
      for (int i = 1; i <= k; i++) printf("%d\n", a[i]);
    else
      printf("No solution\n");
  }
  return 0;
}
