#include <bits/stdc++.h>
using namespace std;
using namespace placeholders;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VS = vector<string>;
using SS = stringstream;
using PII = pair<int, int>;
using VPII = vector<PII>;
template <typename T = int>
using VT = vector<T>;
template <typename T = int>
using VVT = VT<VT<T> >;
template <typename T = int>
using LIM = numeric_limits<T>;
template <typename T>
inline istream &operator>>(istream &s, vector<T> &v) {
  for (auto &t : v) {
    cin >> t;
  }
  return s;
}
template <typename T>
inline ostream &operator<<(ostream &s, vector<T> &v) {
  for (int i = 0; i < v.size(); ++i) {
    s << (" " + !i) << v[i];
  }
  return s;
}
template <typename T>
inline T fromString(const string &s) {
  T res;
  istringstream iss(s);
  iss >> res;
  return res;
};
template <typename T>
inline string toString(const T &a) {
  ostringstream oss;
  oss << a;
  return oss.str();
};
string greed(const string &s, const int b) {
  int res = 0;
  for (int i = (int)(0); i < (int)(s.size()); ++i) {
    const char c = s[i];
    if (c != '?') {
      res = res * 10 + c - '0';
      continue;
    }
    bool done = false;
    for (int d = (int)(!i); d < (int)(10); ++d) {
      int tmp = res * 10 + d;
      for (int j = (int)(i + 1); j < (int)(s.size()); ++j) {
        tmp = tmp * 10 + (s[j] != '?' ? s[j] - '0' : 9);
      }
      if (b < tmp) {
        res = res * 10 + d;
        done = true;
        break;
      }
    }
    if (!done) {
      return "";
    }
  }
  return b < res ? toString(res) : "";
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VS as(n);
  cin >> as;
  int b = 0;
  VS res;
  for (auto &a : as) {
    string tmp = greed(a, b);
    if (tmp == "") {
      cout << "NO" << endl;
      return 0;
    }
    res.push_back(tmp);
    b = fromString<int>(tmp);
  }
  cout << "YES" << endl;
  copy((res).begin(), (res).end(), ostream_iterator<string>(cout, "\n"));
  cout << flush;
  return 0;
}
