#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
string s[maxn];
bool Greater(string &a, string &b) {
  if ((int)a.size() != (int)b.size())
    return ((int)a.size() > (int)b.size());
  else
    return a > b;
}
void build(int idx) {
  string temp = s[idx];
  for (auto &i : temp)
    if (i == '?') i = '9';
  if (!Greater(temp, s[idx - 1])) {
    cout << "NO\n";
    exit(0);
  }
  for (int i = 0; i < (int)temp.size(); i++) {
    if (s[idx][i] != '?') continue;
    while (1) {
      if (i == 0 && temp[i] == '1') break;
      if (i && temp[i] == '0') break;
      temp[i]--;
      if (!Greater(temp, s[idx - 1])) {
        temp[i]++;
        break;
      }
    }
  }
  s[idx] = temp;
}
void fillSmallest(string &str) {
  for (int i = 0; i < (int)str.size(); i++)
    if (str[i] == '?') str[i] = (i == 0) ? '1' : '0';
}
char t[100];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%s", t);
    s[i] = string(t);
  }
  fillSmallest(s[1]);
  for (int i = 2; i <= n; i++) build(i);
  printf("YES\n");
  for (int i = 1; i <= n; i++) printf("%s\n", s[i].c_str());
  return 0;
}
