#include <bits/stdc++.h>
using namespace std;
vector<string> ans;
int gao(const string &pre, string &cur) {
  if (pre.length() > cur.length()) {
    return 0;
  } else if (pre.length() < cur.length()) {
    for (int i = 0; i < cur.length(); i++) {
      if (cur[i] == '?') {
        if (i == 0)
          cur[i] = '1';
        else
          cur[i] = '0';
      }
    }
    return 1;
  } else {
    int success = 0;
    for (int i = (int)pre.length() - 2; i >= -1; i--) {
      int f = 0;
      string tmp = cur;
      for (int j = 0; j <= i; j++) {
        if (tmp[j] == '?')
          tmp[j] = pre[j];
        else if (tmp[j] != pre[j]) {
          f = 1;
          break;
        }
      }
      if (f == 1) continue;
      if (pre[i + 1] == '9' ||
          (tmp[i + 1] != '?' && tmp[i + 1] <= pre[i + 1])) {
        continue;
      }
      if (tmp[i + 1] == '?') tmp[i + 1] = pre[i + 1] + 1;
      for (int j = i + 2; j < pre.length(); j++) {
        if (tmp[j] == '?') {
          tmp[j] = '0';
        }
      }
      cur = tmp;
      success = 1;
      break;
    }
    return success;
  }
}
int main() {
  int n;
  cin >> n;
  string pre = "";
  for (int i = 0; i < n; i++) {
    string tmp;
    cin >> tmp;
    if (gao(pre, tmp) == 0) {
      puts("NO");
      return 0;
    } else
      pre = tmp;
    ans.push_back(pre);
  }
  puts("YES");
  for (auto x : ans) cout << x << endl;
}
