#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000,100000000")
long double max(long double x, long double y) { return x > y ? x : y; }
long double min(long double x, long double y) { return x < y ? x : y; }
using namespace std;
const long long N = 1e5 + 9;
long long pw[N];
long long n, k = 1e10;
string v[N];
vector<long long> ans;
long long cal(string s, long long k) {
  long long res = 0;
  for (long long i = 0; i < s.size(); i++) {
    if (s[i] == '?') {
      res = res * 10;
      if (i == 0) {
        res = res + 1;
      }
    } else
      res = res * 10 + (s[i] - '0');
  }
  if (res >= k) return -1;
  for (long long i = 0; i < s.size(); i++) {
    if (s[i] == '?') {
      for (long long j = 9; j >= 0; j--) {
        if (!i && !j) continue;
        long long mx = res + (j - (i == 0)) * pw[s.size() - i - 1];
        if (mx < k) {
          res = mx;
          break;
        }
      }
    }
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> v[i];
  pw[0] = 1;
  for (long long i = 0; i < 100; i++) pw[i + 1] = pw[i] * 10;
  for (long long i = n - 1; i >= 0; i--) {
    k = cal(v[i], k);
    if (k == -1) {
      cout << "NO\n";
      return 0;
    } else
      ans.push_back(k);
  }
  cout << "YES\n";
  for (long long i = 0; i < ans.size(); i++)
    cout << ans[ans.size() - i - 1] << endl;
}
