#include <bits/stdc++.h>
using namespace std;
int solve(int fir, int sec) {
  int cnt = 0;
  for (; fir != 0; fir /= 10, sec /= 10)
    if (fir % 10 != sec % 10) cnt++;
  if (cnt < 2)
    return 1;
  else
    return 0;
}
int main() {
  int n, k, i, l = 1000, a[2005], flag = 1, j;
  scanf("%d", &n);
  for (int t = 1; t <= n; t++) {
    scanf("%d", &k);
    for (i = l; i < 2012; i++)
      if (solve(k, i)) {
        a[t] = i;
        break;
      }
    if (a[t] == 0) flag = 0;
    l = a[t];
  }
  if (!flag)
    puts("No solution");
  else {
    for (i = 1; i <= n; i++) printf("%d\n", a[i]);
  }
  return 0;
}
