#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int SIZE = 1e6 + 10;
char s[100010][10], tmp[10];
int main() {
  int(n);
  scanf("%d", &n);
  for (int i = 0; i < (n); ++i) {
    scanf("%s", (s[i]));
  }
  int lt = 0;
  for (int i = 0; i < (n); ++i) {
    strcpy(tmp, s[i]);
    int len = strlen(s[i]);
    for (int j = 0; j < (len); ++j)
      if (tmp[j] == '?') tmp[j] = '9';
    for (int j = 0; j < (len); ++j) {
      if (s[i][j] == '?') {
        bool suc = false;
        for (int k = 0; k < (10); ++k) {
          if (!j && !k) continue;
          tmp[j] = k + '0';
          if (atoi(tmp) > lt) {
            suc = true;
            break;
          }
        }
        if (!suc) {
          puts("NO");
          return 0;
        }
      }
    }
    if (atoi(tmp) <= lt) {
      puts("NO");
      return 0;
    }
    lt = atoi(tmp);
    strcpy(s[i], tmp);
  }
  puts("YES");
  for (int i = 0; i < (n); ++i) {
    puts(s[i]);
  }
  return 0;
}
