490_E. Restoring Increasing Sequence_5246
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
import static java.lang.Math.max;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;

public class CF_279E {

    static Reader sc = new Reader();
    static PrintWriter out = new PrintWriter(System.out);

    static void compMin(char[] num, int from) {
        for(int i=from; i<num.length; i++) {
            if(num[i]=='?')
                num[i]='0';
        }       
    }

    static boolean compare(char[] act, char[] prev, int from) {     
        for(int i=from; i<prev.length; i++) {
            if(act[i]>prev[i]){
                return true;
            } else if (act[i]<prev[i]) {
                return false;
            }
        }           
        return false;       
    }

    static char[] getMin(char[] act, char[] prev, int from) {
        if(from==act.length) {
            act[0] = 'X';
            return act;
        }
        int i=from;
        if(act[i]!='?') {
            if(prev[i]> act[i]){
                act[0] ='X';
                return act;
            } else if(prev[i]< act[i]){
                compMin(act, from);
                return act;
            } else {
                char[] aux = act.clone();               
                aux = getMin(aux,prev,from+1);                  
                if(!(aux[0]=='X') && compare(aux,prev,from)){
                    return aux;
                } else {
                    act[0] = 'X';
                    return act;
                }
            }
        } else {
            if(from==0 && prev[0]=='0') {
                act[0] = '1';
                return getMin(act,prev,from);
            }
            char[] aux = act.clone();               
            aux = getMin(aux,prev,from+1);          
            if(!(aux[0]=='X') && compare(aux,prev,from+1)){
                aux[i] = prev[i];
                return aux;
            } else if(prev[i]<'9'){
                act[i] = (char)((int)prev[i]+1);
                compMin(act, from);
                return act;
            } else {
                act[0] = 'X';
                return act;
            }
        }
    }

    public static void main(String[] args) throws IOException {             
        int n = sc.nextInt();

        int[] res = new int[n];
        char[][] resc = new char[n][];

        for(int i=0; i<n; i++) {
            if(i==0) {
                char[] act = sc.next().toCharArray();
                compMin(act, 0);
                act[0] = (char)max((int)act[0],(int)'1');
                res[i] = getInt(act);
                resc[i] = act;
                continue;
            }

            char[] act = sc.next().toCharArray();
            char[] prev = new char[act.length];         
            char[] prevRaw = resc[i-1];

            if (act.length<prevRaw.length) {
                out.println("NO");
                out.close();
                return;             
            }

            for(int x=0;x<prev.length-prevRaw.length;x++)
                prev[x] = '0';
            for(int x=0; x<prevRaw.length;x++){
                prev[x+prev.length-prevRaw.length] = prevRaw[x];
            }
            char[] actRes = getMin(act, prev, 0);
            if(actRes[0]=='X'){
                out.println("NO");
                out.close();
                return;     
            }
            resc[i] = actRes;
            res[i] = getInt(actRes);
            if (res[i]<=res[i-1]) {
                out.println("NO");
                out.close();
                return;     
            }
        }
        System.out.println("YES");
        for(int i=0; i<n; i++)
            System.out.println(res[i]);

        out.close();
    }

    static int getInt(char[] s) {
        int ret=0;
        int i=0;
        while(s[i]<='0' && i<s.length)i++;
        for(; i<s.length;i++) {
            ret=ret*10+s[i]-'0';
        }
        return ret;
    }
    
    static int getInt(char[] s, int from) {
        int ret=0;
        int i=from;
        while(s[i]<='0' && i<s.length)i++;
        for(; i<s.length;i++) {
            ret=ret*10+s[i]-'0';
        }
        return ret;
    }
    
    static int getInt(String s) {
        int ret=0;
        int i=0;
        while(s.charAt(i)<='0' && i<s.length())i++;
        for(; i<s.length();i++) {
            ret=ret*10+s.charAt(i)-'0';
        }
        return ret;
    }
    
    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;private byte[] buffer;private int bufferPointer, bytesRead;
        public Reader(){buffer=new byte[BUFFER_SIZE];bufferPointer=bytesRead=0;
        }private void fillBuffer() throws IOException{bytesRead=System.in.read(buffer,bufferPointer=0,BUFFER_SIZE);if(bytesRead==-1)buffer[0]=-1;
        }private byte read() throws IOException{if(bufferPointer==bytesRead)fillBuffer();return buffer[bufferPointer++];
        }public String next() throws IOException{StringBuilder sb = new StringBuilder();byte c;while((c=read())<=' ');do{sb.append((char)c);} while((c=read())>' ');return sb.toString();
        }public String nextLine() throws IOException{StringBuilder sb = new StringBuilder();byte c;while((c=read())!=-1){if(c=='\n')break;sb.append((char)c);}return sb.toString();
        }public int nextInt() throws IOException{int ret=0;byte c=read();while(c<=' ')c=read();boolean neg=(c=='-');if(neg)c=read();do{ret=ret*10+c-'0';}while((c=read())>='0'&&c<='9');if(neg)return -ret;return ret;
        }public long nextLong() throws IOException{long ret=0;byte c=read();while(c<=' ')c=read();boolean neg=(c=='-');if(neg)c=read();do{ret=ret*10L+c-'0';}while((c=read())>='0'&&c<='9');if(neg)return -ret;return ret;
        }public double nextDouble() throws IOException{double ret=0,div=1;byte c=read();while(c<=' ')c=read();boolean neg=(c=='-');if(neg)c = read();do {ret=ret*10+c-'0';}while((c=read())>='0'&&c<='9');if(c=='.')while((c=read())>='0'&&c<='9')ret+=(c-'0')/(div*=10);if(neg)return -ret;return ret;             
        }public void close() throws IOException{if(System.in==null) return;System.in.close();}  
    }

    static void print(int[] A) {for(int i=0;i<A.length;i++){if(i!=0) out.print(' ');out.print(A[i]);}out.println();}

}
