#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-5;
int change(int num, int d, int n) {
  int res = num;
  int offset = 1;
  for (int i = 0; i < d; i++) offset *= 10;
  int up = res / offset;
  return (up - up % 10) * offset + num % offset + n * offset;
}
int main() {
  int a;
  cin >> a;
  vector<int> ans;
  int previous = 0;
  for (int i = 0; i < a; i++) {
    int num;
    cin >> num;
    int res = 10000;
    for (int d = 3; d >= 0; d--) {
      for (int n = 0; n < 10; n++) {
        if (n == 0 && d == 3) continue;
        int cur = change(num, d, n);
        if (cur >= previous) {
          res = min(cur, res);
        }
      }
    }
    if (res > 2011) {
      cout << "No solution";
      return 0;
    } else {
      previous = res;
      ans.push_back(res);
    }
  }
  for (int i = 0; i < a; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}
