490_E. Restoring Increasing Sequence_5244
Peter wrote on the board a strictly increasing sequence of positive integers a1, a2, ..., an. Then Vasil replaced some digits in the numbers of this sequence by question marks. Thus, each question mark corresponds to exactly one lost digit.

Restore the the original sequence knowing digits remaining on the board.

Input

The first line of the input contains integer n (1 ≤ n ≤ 105) — the length of the sequence. Next n lines contain one element of the sequence each. Each element consists only of digits and question marks. No element starts from digit 0. Each element has length from 1 to 8 characters, inclusive.

Output

If the answer exists, print in the first line "YES" (without the quotes). Next n lines must contain the sequence of positive integers — a possible variant of Peter's sequence. The found sequence must be strictly increasing, it must be transformed from the given one by replacing each question mark by a single digit. All numbers on the resulting sequence must be written without leading zeroes. If there are multiple solutions, print any of them.

If there is no answer, print a single line "NO" (without the quotes).

Examples

Input

3
?
18
1?


Output

YES
1
18
19


Input

2
??
?


Output

NO


Input

5
12224
12??5
12226
?0000
?00000


Output

YES
12224
12225
12226
20000
100000
#include <bits/stdc++.h>
using namespace std;
string mini(string a, string b) {
  if (a.size() < b.size()) return a;
  if (a.size() > b.size()) return b;
  for (int c = 0; c < (int)a.size(); c++) {
    if (a[c] < b[c]) return a;
    if (a[c] > b[c]) return b;
  }
  return a;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  string prev = "0";
  vector<string> ans;
  while (n--) {
    string num;
    cin >> num;
    if (prev.size() > num.size()) {
      cout << "NO\n";
      exit(0);
    } else if (num.size() > prev.size()) {
      for (int c = 0; c < num.size(); c++) {
        if (num[c] == '?') {
          num[c] = ('0' + (c == 0));
        }
      }
    } else {
      string gg = "99999999999";
      if (mini(num, prev) == prev && num != prev) {
        int c_q = 0;
        for (auto cym : num) c_q += (cym == '?');
        if (c_q == 0) {
          gg = num;
        }
      }
      for (int c = 0; c < num.size(); c++) {
        if ((prev[c] != '9' && num[c] == '?') ||
            (num[c] != '?' && prev[c] < num[c])) {
          string num2 = num;
          if (num2[c] == '?' && prev[c] != '9') num2[c] = (char)(prev[c] + 1);
          bool can = true;
          for (int c0 = 0; c0 < c; c0++) {
            if (num[c0] == '?' || num[c0] == prev[c0]) {
              num2[c0] = prev[c0];
            } else {
              can = false;
            }
          }
          for (int c1 = c + 1; c1 < num.size(); c1++) {
            if (num2[c1] == '?') {
              num2[c1] = '0';
            }
          }
          if (can && (mini(num2, prev) == prev && prev != num2)) {
            gg = mini(gg, num2);
          }
        }
      }
      if (gg.size() > 10) {
        cout << "NO\n";
        exit(0);
      }
      num = gg;
    }
    ans.push_back(num);
    prev = num;
  }
  cout << "YES\n";
  for (auto s : ans) {
    cout << s << '\n';
  }
}
