human
Give me a Python code to determine whether all the words of the Old Berland language can be reconstructed and if they can, output the words themselves given the following:
Berland scientists know that the Old Berland language had exactly n words. Those words had lengths of l1, l2, ..., ln letters. Every word consisted of two letters, 0 and 1. Ancient Berland people spoke quickly and didn’t make pauses between the words, but at the same time they could always understand each other perfectly. It was possible because no word was a prefix of another one. The prefix of a string is considered to be one of its substrings that starts from the initial symbol.

Help the scientists determine whether all the words of the Old Berland language can be reconstructed and if they can, output the words themselves.

Input

The first line contains one integer N (1 ≤ N ≤ 1000) — the number of words in Old Berland language. The second line contains N space-separated integers — the lengths of these words. All the lengths are natural numbers not exceeding 1000.

Output

If there’s no such set of words, in the single line output NO. Otherwise, in the first line output YES, and in the next N lines output the words themselves in the order their lengths were given in the input file. If the answer is not unique, output any.

Examples

Input

3
1 2 3

Output

YES
0
10
110

Input

3
1 1 1

Output

NO
Solve the task in PYTHON.
assistant
#Here is Python code to determine whether all the words of the Old Berland language can be reconstructed and if they can, output the words themselves.

'''
http://codeforces.com/contest/37/problem/C
'''
from collections import defaultdict
import sys
sys.setrecursionlimit(10**8) 

class Node(object):
    def __init__(self):
        self.countWord = 0
        self.child = dict()

class Trie(object):
    def __init__(self):
        self.root = Node()

    def generateWord(self, node, length, string_result):
        if length == 0:
            node.countWord += 1
            return True, string_result
        temp = node
        if not temp.child:
            temp.child[0] = Node()
            return self.generateWord(temp.child[0], length-1, string_result + '0')
        elif len(temp.child) == 1:
            temp.child[1] = Node()
            return self.generateWord(temp.child[1], length-1, string_result + '1')
        else:
            if node.child[0].countWord != 1:
                can_go_further_0, final_string_0 = self.generateWord(node.child[0], length-1, string_result+'0')
            else:
                can_go_further_0 = False
            if can_go_further_0:
                return True, final_string_0
            
            if node.child[1].countWord != 1:
                can_go_further_1, final_string_1 = self.generateWord(node.child[1], length-1, string_result+'1')
            else:
                can_go_further_1 = False
            if can_go_further_1: return True, final_string_1
            else: return False, string_result

number_of_word = int(raw_input())
list_of_length_word = list(map(int, raw_input().rstrip().split(" ")))
result = [''] * len(list_of_length_word)
trie_language = Trie()
can_build_a_tree = True
convert_to_index = defaultdict(list)
for index, number in enumerate(list_of_length_word):
    convert_to_index[number].append(index)

list_of_length_word = sorted(list_of_length_word)
for element in list_of_length_word:
    can_generate_word, result_string = trie_language.generateWord(trie_language.root, element, '')
    if can_generate_word:
        first_index = convert_to_index[element].pop()
        result[first_index] =...