#include <bits/stdc++.h>
using namespace std;
int main() {
  bool can = 0;
  int n;
  cin >> n;
  int arr[n + 1];
  arr[0] = 1000;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  for (int i = 1; i <= n; i++) {
    if (arr[i] > arr[i - 1]) {
      bool f = 0;
      for (int j = 1000; j > 0; j /= 10) {
        if (f) break;
        for (int k = (j > 1) ? ((arr[i] % (j * 10)) / j) : arr[i] % (j * 10);
             k > 0; k--) {
          if (arr[i] - k * j >= arr[i - 1] && !(arr[i] - k * j < 1000)) {
            f = 1;
            arr[i] -= k * j;
            break;
          }
        }
      }
    } else if (arr[i] < arr[i - 1]) {
      bool f = 0;
      for (int j = 1; j < 10000; j *= 10) {
        if (f) break;
        int l =
            (j > 1) ? 9 - ((arr[i] % (j * 10)) / j) : 9 - (arr[i] % (j * 10));
        for (int k = 1; k <= l; k++) {
          if (arr[i] + k * j >= arr[i - 1]) {
            f = 1;
            arr[i] += k * j;
            break;
          }
        }
      }
      if (!f) {
        can = 1;
        break;
      }
    }
    if (arr[i] > 2011) {
      can = 1;
      break;
    }
  }
  if (can) {
    cout << "No solution\n";
  } else {
    for (int i = 1; i <= n; i++) cout << arr[i] << endl;
  }
  return 0;
}
