#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
char S[maxn][10];
int ju(char a[], char b[]) {
  int n = strlen(a), m = strlen(b);
  int x = 0, y = 0;
  for (int i = 0; i < n; i++) x = x * 10 + a[i] - '0';
  for (int j = 0; j < m; j++) y = y * 10 + (b[j] == '?' ? 9 : b[j] - '0');
  return x < y;
}
int f(int ind) {
  int m = strlen(S[ind - 1]), n = strlen(S[ind]);
  if (m < n) {
    for (int i = 0; i < n; i++)
      if (S[ind][i] == '?') {
        if (i == 0)
          S[ind][i] = '1';
        else
          S[ind][i] = '0';
      }
  } else if (m > n) {
    return 1;
  } else {
    for (int i = 0; i < n; i++) {
      if (S[ind][i] == '?')
        for (int j = 0; j <= 9; j++) {
          S[ind][i] = '0' + j;
          if (ju(S[ind - 1], S[ind])) break;
        }
    }
    if (!ju(S[ind - 1], S[ind])) return 1;
  }
  return 0;
}
int main() {
  int n;
  while (scanf("%d", &n) > 0) {
    int si = 1;
    S[0][0] = '0';
    S[0][1] = '\0';
    for (int i = 1; i <= n; i++) {
      scanf("%s", S[i]);
      if (si && f(i)) si = 0;
    }
    if (si) {
      printf("YES\n");
      for (int i = 1; i <= n; i++) printf("%s\n", S[i]);
    } else {
      printf("NO\n");
    }
  }
  return 0;
}
