Problem: A PIN code is a string that consists of exactly 4 digits. Examples of possible PIN codes: 7013, 0000 and 0990. Please note that the PIN code can begin with any digit, even with 0.

Polycarp has n (2 ≤ n ≤ 10) bank cards, the PIN code of the i-th card is p_i.

Polycarp has recently read a recommendation that it is better to set different PIN codes on different cards. Thus he wants to change the minimal number of digits in the PIN codes of his cards so that all n codes would become different.

Formally, in one step, Polycarp picks i-th card (1 ≤ i ≤ n), then in its PIN code p_i selects one position (from 1 to 4), and changes the digit in this position to any other. He needs to change the minimum number of digits so that all PIN codes become different.

Polycarp quickly solved this problem. Can you solve it?

Input

The first line contains integer t (1 ≤ t ≤ 100) — the number of test cases in the input. Then test cases follow.

The first line of each of t test sets contains a single integer n (2 ≤ n ≤ 10) — the number of Polycarp's bank cards. The next n lines contain the PIN codes p_1, p_2, ..., p_n — one per line. The length of each of them is 4. All PIN codes consist of digits only.

Output

Print the answers to t test sets. The answer to each set should consist of a n + 1 lines

In the first line print k — the least number of changes to make all PIN codes different. In the next n lines output the changed PIN codes in the order corresponding to their appearance in the input. If there are several optimal answers, print any of them.

Example

Input


3
2
1234
0600
2
1337
1337
4
3139
3139
3139
3139


Output


0
1234
0600
1
1337
1237
3
3139
3138
3939
6139

Solution (in PYTHON3):

Solution:
def parse_one_pin(pin, set_of_pins):
    for i in range(1,5):
        list_of_indices = indices_to_change(i)
        for indices in list_of_indices:
            new_pin = check_digits_change(pin, set_of_pins, indices)
            if new_pin is not None:
                return new_pin, indices


def parse_test_set(list_of_pins):
    dict_of_pins = {}
    new_list_of_pins = []
    for pin in list_of_pins:
        dict_of_pins[pin] = dict_of_pins[pin] + 1 if pin in dict_of_pins.keys() else 1
        new_list_of_pins.append(pin)

    total_changes = 0

    for idx, pin in enumerate(list_of_pins):
        current_set_of_pins = set(new_list_of_pins)
        # if dict_of_pins[pin] == 1:
        #     current_set_of_pins.remove(pin)
        if dict_of_pins[pin] > 1:
            new_pin, indices = parse_one_pin(pin, current_set_of_pins)
            total_changes += len(indices)
            new_list_of_pins[idx] = new_pin
            dict_of_pins[pin] -= 1

    print_res(new_list_of_pins, total_changes)
    #return new_list_of_pins

def indices_to_change(digit_to_modify):

    if digit_to_modify == 1:
        indices_to_modify = [[0], [1], [2], [3]]
    if digit_to_modify == 2:
        indices_to_modify = [(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2,3)]
    if digit_to_modify == 3:
        indices_to_modify = [(0, 1, 2), (0, 1, 3), (0, 2, 3), (1, 2, 3)]
    if digit_to_modify == 4:
        indices_to_modify = [(1, 2, 3, 4)]
    return indices_to_modify

def check_digits_change(pin, pins_to_avoid, indices):
    new_pin = [int(x) for x in pin]
    for f in range(0, 10**len(indices)):
        digits_of_f = int_to_pin(f)
        #print('f = {}, digits_of_f = {}'.format(f, digits_of_f))
        #print(digits_of_f)
        for i, index in enumerate(indices):
            new_pin[index] = digits_of_f[3-i]
            new_pin_str = ''.join(str(i) for i in new_pin)
            if new_pin_str not in pins_to_avoid:
                return ''.join(str(i) for i in new_pin)
    return None

def int_to_pin(number):
    list_of_digits = [int(d) for d in str(number)]
    while len(list_of_digits) < 4:
        list_of_digits = [0] + list_of_digits

    return list_of_digits

def print_res(result, total_changes):
    print(total_changes)
    for x in result:
        print(x)

t = int(input())
ls = []
ns = []
for _ in range(t):
    local_n = int(input())
    ns.append(local_n)
    local_list_of_cards = []
    for _ in range(local_n):
        local_list_of_cards.append(input())
    ls.append(local_list_of_cards)

for i, x in enumerate(ls):
    parse_test_set(x)