#include <bits/stdc++.h>
using namespace std;
inline int POPCNT(int _x) { return __builtin_popcount(_x); }
inline int POPCNT(long long _x) { return __builtin_popcountll(_x); }
const int iINF = 1L << 30;
const long long lINF = 1LL << 60;
double EPS = 1e-9;
inline bool in_range(int _v, int _mx, int _mi) { return _mi <= _v && _v < _mx; }
inline bool in_range(double _v, double _mi, double _mx) {
  return -EPS < _v - _mi && _v - _mx < EPS;
}
inline bool in_range(int _x, int _y, int _W, int _H) {
  return 0 <= _x && _x < _W && 0 <= _y && _y < _H;
}
const int DX[4] = {0, 1, 0, -1}, DY[4] = {-1, 0, 1, 0};
const int DX_[8] = {0, 1, 1, 1, 0, -1, -1, -1},
          DY_[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
inline void modAdd(int& _a, int _b, int _m) { _a = (_a + _b) % _m; }
inline void modAdd(long long& _a, long long _b, long long _m) {
  _a = (_a + _b) % _m;
}
inline void minUpdate(int& _a, int _b) { _a = min(_a, _b); }
inline void minUpdate(long long& _a, long long _b) { _a = min(_a, _b); }
inline void maxUpdate(int& _a, int _b) { _a = max(_a, _b); }
inline void maxUpdate(long long& _a, long long _b) { _a = max(_a, _b); }
int n;
string numbers[100010];
bool rec(int i, string a, string& b, bool win) {
  if (i == (int)b.size()) return win;
  if (win) {
    if (b[i] == '?') b[i] = '0';
    return rec(i + 1, a, b, true);
  } else {
    if (b[i] == '?') {
      b[i] = a[i];
      if (rec(i + 1, a, b, false)) return true;
      b[i] = '?';
      if (a[i] != '9') {
        char nb = a[i] + 1;
        b[i] = nb;
        if (rec(i + 1, a, b, true)) return true;
        b[i] = '?';
      }
    } else {
      if (a[i] > b[i]) return false;
      if (a[i] < b[i])
        return rec(i + 1, a, b, true);
      else
        return rec(i + 1, a, b, false);
    }
  }
  return false;
}
bool construct(string a, string& b) {
  int la = (int)a.size(), lb = (int)b.size();
  if (la > lb) return false;
  if (la < lb) {
    if (b[0] == '?') b[0] = '1';
    for (int i = 1; i < lb; ++i)
      if (b[i] == '?') b[i] = '0';
    return true;
  }
  return rec(0, a, b, false);
}
void solve() {
  for (int i = 0; i < n; ++i) {
    if (!construct(numbers[i], numbers[i + 1])) {
      cout << "NO" << endl;
      return;
    }
  }
  cout << "YES" << endl;
  for (int i = 1; i < n + 1; ++i) cout << numbers[i] << endl;
}
int main() {
  cin >> n;
  numbers[0] = "0";
  for (int i = 1; i < n + 1; ++i) cin >> numbers[i];
  solve();
  return 0;
}
