You are given three integers $$$a$$$, $$$b$$$, $$$k$$$.Find two binary integers $$$x$$$ and $$$y$$$ ($$$x \ge y$$$) such that   both $$$x$$$ and $$$y$$$ consist of $$$a$$$ zeroes and $$$b$$$ ones;  $$$x - y$$$ (also written in binary form) has exactly $$$k$$$ ones.  You are not allowed to use leading zeros for $$$x$$$ and $$$y$$$.

The only line contains three integers $$$a$$$, $$$b$$$, and $$$k$$$ ($$$0 \leq a$$$; $$$1 \leq b$$$; $$$0 \leq k \leq a + b \leq 2 \cdot 10^5$$$) — the number of zeroes, ones, and the number of ones in the result.

If it's possible to find two suitable integers, print "Yes" followed by $$$x$$$ and $$$y$$$ in base-2. Otherwise print "No". If there are multiple possible answers, print any of them.

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var [a, b, k] = lines[0].trim().split(' ').map(Number)
    console.log(solve(a, b, k));
});

function solve(a, b, k) {
    if (k === 0) {
        const s = Array(b).fill(1).join('') + Array(a).fill(0).join('')
        return ['Yes', s, s].join('\n')
    }
    if (a < 1 || b < 2 || a + b < k + 2) return 'No'

    // 1, ?, i, k - 1, j
    const x = []
    const y = []
    const j = a + b - 1
    const i = j - k
    let zero = a - 1 // reserved for i and j
    let one = b - 1
    for (let p = 0; p < a + b; p++) {
        if (!p) {
            x[p] = y[p] = 1
            one--
        } else if (p === i) {
            x[p] = 1
            y[p] = 0
        } else if (p === j) {
            x[p] = 0
            y[p] = 1
        } else {
            if (zero) {
                x[p] = y[p] = 0
                zero--
            } else {
                x[p] = y[p] = 1
                one--
            }
        }
    }
    return ['Yes', x.join(''), y.join('')].join('\n')
}

function getInt(num){
        return parseInt(num, 10)
    }

var line = readline().split(' ').map(getInt);

getXY.apply(undefined, line)

function getXY(zerous, ones, k){

    if(k === 0){
        print('YES');
        var rest = getRest(zerous, ones).join('');

        print(rest);
        print(rest);
        return;
    }
    if(zerous === 0 || ones === 0){
        print('NO')
        return;
    }

    if(zerous + ones - 2 < k){
        print('NO')
        return;
    }

    if(ones === 1){
        print('NO')
        return;
    }

    getPatt(zerous, ones, k)

}

function addChars(arr, ch, n){
    for(var i = 0; i < n; i++){
        arr.push(ch);
    }
}

function getEndPatt(zerous, ones, k){
    var pattX = [];
    var pattY = [];
    var z = zerous;
    var o = ones;
    var newK = k;

    var zs = Math.min(k, zerous);

    //pattX.push(1);
    addChars(pattX, 0, zs)

    addChars(pattY, 0, zs-1)
    pattY.push(1);

    //o--;
    z = z - zs;
    newK = newK - zs;
    return [pattX, pattY, z, o, newK]
}
function getPatt(zerous, ones, k){

    var x = [1];
    var y = [1];
    ones--;

    var pattEnd = getEndPatt(zerous, ones, k);

    zerous = pattEnd[2];
    ones = pattEnd[3];
    k = pattEnd[4];

    var pattSt = getStartPatt(zerous, ones, k);

    zerous = pattSt[2];
    ones = pattSt[3];
    k = pattSt[4];

    var rest = getRest(zerous, ones);

    x = x.concat(pattSt[0]);
    y = y.concat(pattSt[1]);
    x = x.concat(pattEnd[0]);
    y = y.concat(pattEnd[1]);
    x = x.concat(rest);
    y = y.concat(rest);

    print('YES');

    print(x.join(''))

    print(y.join(''))

}
function getStartPatt(zerous, ones, k){
    var pattX = [];
    var pattY = [];
    var z = zerous;
    var o = ones;
    var newK = k;

    pattX.push(1);
    pattY.push(0);
    o--;

    var os = Math.min(k, o);

    addChars(pattX, 1, os);
    addChars(pattY, 1, os);

    o = o - os;

    newK = k - os;

    return [pattX, pattY, z, o, newK]
}

function getRest(zerous, ones){
    var rest = [];
    addChars(rest, 1, ones)
    addChars(rest, 0, zerous)
    return rest;
}

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var [a, b, k] = lines[0].trim().split(' ').map(Number)
    console.log(solve(a, b, k));
});

function solve(a, b, k) {
    if (a < 1 || b < 2 || a + b < k + 2) return 'No'

    // 1, ?, i, k - 1, j
    const x = []
    const y = []
    const j = a + b - 1
    const i = j - k
    let zero = a - 1 // reserved for i and j
    let one = b - 1
    for (let p = 0; p < a + b; p++) {
        if (!p) {
            x[p] = y[p] = 1
            one--
        } else if (p === i) {
            x[p] = 1
            y[p] = 0
        } else if (p === j) {
            x[p] = 0
            y[p] = 1
        } else {
            if (zero) {
                x[p] = y[p] = 0
                zero--
            } else {
                x[p] = y[p] = 1
                one--
            }
        }
    }
    return ['Yes', x.join(''), y.join('')].join('\n')
}

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var [a, b, k] = lines[0].trim().split(' ').map(Number)
    console.log(solve(a, b, k));
});

function solve(a, b, k) {
    if (a < 1 || b < 2 || a + b < k + 2) return 'No'

    // 1, ?, i, k - 1, j
    const x = []
    const y = []
    const j = a + b - 1
    const i = j - k
    let zero = a - 1 // reserved for i and j
    let one = b - 1
    for (let p = 0; p < a + b; p++) {
        if (!p) {
            x[p] = y[p] = 1
            zero--
            one--
        } else if (p === i) {
            x[p] = 1
            y[p] = 0
        } else if (p === j) {
            x[p] = 0
            y[p] = 1
        } else {
            if (zero) {
                x[p] = y[p] = 0
                zero--
            } else {
                x[p] = y[p] = 1
                one--
            }
        }
    }
    return ['Yes', x.join(''), y.join('')].join('\n')
}

function getInt(num){
        return parseInt(num, 10)
    }

var line = readline().split(' ').map(getInt);

getXY.apply(undefined, line)

function getXY(zerous, ones, k){

    if(k === 0){
        print('YES');
        var rest = getRest(zerous, ones).join('');

        print(rest);
        print(rest);
        return;
    }

    if(zerous + ones - 2 < k){
        print('NO')
        return;
    }

    if(ones === 1){
        print('NO')
        return;
    }

    getPatt(zerous, ones, k)

}

function addChars(arr, ch, n){
    for(var i = 0; i < n; i++){
        arr.push(ch);
    }
}

function getEndPatt(zerous, ones, k){
    var pattX = [];
    var pattY = [];
    var z = zerous;
    var o = ones;
    var newK = k;

    var zs = Math.min(k, zerous);

    //pattX.push(1);
    addChars(pattX, 0, zs)

    addChars(pattY, 0, zs-1)
    pattY.push(1);

    //o--;
    z = z - zs;
    newK = newK - zs;
    return [pattX, pattY, z, o, newK]
}
function getPatt(zerous, ones, k){

    var x = [1];
    var y = [1];
    ones--;

    var pattEnd = getEndPatt(zerous, ones, k);

    zerous = pattEnd[2];
    ones = pattEnd[3];
    k = pattEnd[4];

    var pattSt = getStartPatt(zerous, ones, k);

    zerous = pattSt[2];
    ones = pattSt[3];
    k = pattSt[4];

    var rest = getRest(zerous, ones);

    x = x.concat(pattSt[0]);
    y = y.concat(pattSt[1]);
    x = x.concat(pattEnd[0]);
    y = y.concat(pattEnd[1]);
    x = x.concat(rest);
    y = y.concat(rest);

    print('YES');

    print(x.join(''))

    print(y.join(''))

}
function getStartPatt(zerous, ones, k){
    var pattX = [];
    var pattY = [];
    var z = zerous;
    var o = ones;
    var newK = k;

    pattX.push(1);
    pattY.push(0);
    o--;

    var os = Math.min(k, o);

    addChars(pattX, 1, os);
    addChars(pattY, 1, os);

    o = o - os;

    newK = k - os;

    return [pattX, pattY, z, o, newK]
}

function getRest(zerous, ones){
    var rest = [];
    addChars(rest, 1, ones)
    addChars(rest, 0, zerous)
    return rest;
}

function getInt(num){
        return parseInt(num, 10)
    }

var line = readline().split(' ').map(getInt);

getXY.apply(undefined, line)

function getXY(zerous, ones, k){

    if(k === 0){
        print('YES');
        var rest = getRest(zerous, ones).join('');

        print(rest);
        print(rest);
        return;
    }

    if(zerous + ones - 2 < k){
        print('NO')
        return;
    }

    if(ones === 1){
        print('NO')
        return;
    }

    getPatt(zerous, ones, k)

}

function addChars(arr, ch, n){
    for(var i = 0; i < n; i++){
        arr.push(ch);
    }
}

function getEndPatt(zerous, ones, k){
    var pattX = [];
    var pattY = [];
    var z = zerous;
    var o = ones;
    var newK = k;

    var zs = Math.min(k, zerous);

    addChars(pattX, 0, zs)

    addChars(pattY, 0, zs-1)
    pattY.push(1);

    o--;
    z = z - zs;
    newK = newK - zs;
    return [pattX, pattY, z, o, newK]
}
function getPatt(zerous, ones, k){

    var x = [1];
    var y = [1];
    ones--;
    var pattSt = getStartPatt(zerous, ones, k);
    x = x.concat(pattSt[0]);
    y = y.concat(pattSt[1]);

    zerous = pattSt[2];
    ones = pattSt[3];
    k = pattSt[4];

    var pattEnd = getEndPatt(zerous, ones, k);
    x = x.concat(pattEnd[0]);
    y = y.concat(pattEnd[1]);

    zerous = pattEnd[2];
    ones = pattEnd[3];
    k = pattEnd[4];

    var rest = getRest(zerous, ones);
    x = x.concat(rest);
    y = y.concat(rest);

    print('YES');

    print(x.join(''))

    print(y.join(''))

}
function getStartPatt(zerous, ones, k){
    var pattX = [];
    var pattY = [];
    var z = zerous;
    var o = ones;
    var newK = k;

    pattX.push(1);
    pattY.push(0);
    o--;

    var os = Math.min(k, o);

    addChars(pattX, 1, os);
    addChars(pattY, 1, os);

    o = o - os;

    newK = k - os;

    return [pattX, pattY, z, o, newK]
}

function getRest(zerous, ones){
    var rest = [];
    addChars(rest, 1, ones)
    addChars(rest, 0, zerous)
    return rest;
}

function getInt(num){
        return parseInt(num, 10)
    }

var line = readline().split(' ').map(getInt);

getXY.apply(undefined, line)

function getXY(zerous, ones, k){

    if(k === 0){
        print('YES');
        var rest = getRest(zerous, ones).join('');

        print(rest);
        print(rest);
        return;
    }

    if(zerous + ones - 2 < k){
        print('NO')
        return;
    }

    if(ones === 1){
        print('NO')
        return;
    }

    getPatt(zerous, ones, k)

}

function addChars(arr, ch, n){
    for(var i = 0; i < n; i++){
        arr.push(ch);
    }
}

function getEndPatt(zerous, ones, k){
    var pattX = [];
    var pattY = [];
    var z = zerous;
    var o = ones;
    var newK = k;

    var zs = Math.min(k, zerous);

    addChars(pattX, 0, zs)

    addChars(pattY, 0, zs-1)
    pattY.push(1);

    o--;
    z = z - zs;
    newK = newK - zs;
    return [pattX, pattY, z, o, newK]
}
function getPatt(zerous, ones, k){

    var x = [1];
    var y = [1];
    ones--;
    var pattSt = getStartPatt(zerous, ones, k);
    x = x.concat(pattSt[0]);
    y = y.concat(pattSt[1]);

    zerous = pattSt[2];
    ones = pattSt[3];
    k = pattSt[4];

    var pattEnd = getEndPatt(zerous, ones, k);
    x = x.concat(pattEnd[0]);
    y = y.concat(pattEnd[1]);

    zerous = pattEnd[2];
    ones = pattEnd[3];
    k = pattEnd[4];

    var rest = getRest(zerous, ones);
    x = x.concat(rest);
    y = y.concat(rest);

    print('YES');

    print(x.join(''))

    print(y.join(''))

}
function getStartPatt(zerous, ones, k){
    var pattX = [];
    var pattY = [];
    var z = zerous;
    var o = ones;
    var newK = k;

    pattX.push(1);
    pattY.push(0);
    o--;

    var os = Math.min(k, o);

    addChars(pattX, 1, os);
    addChars(pattY, 1, os);

    o = o - os;

    newK = k - os;

    return [pattX, pattY, z, o, newK]
}

function getRest(zerous, ones){
    var rest = [];
    addChars(rest, 0, zerous)
    addChars(rest, 1, ones)
    return rest;
}

function getInt(num){
        return parseInt(num, 10)
    }

var line = readline().split(' ').map(getInt);

getXY.apply(undefined, line)

function getXY(zerous, ones, k){
    var x;
    var y;
    if(zerous < k){
        print('NO')
        return;
    }
    if(k === 0){
        print('YES');
        x = [];
        addChars(x, 1, ones)
        addChars(x, 0, zerous)

        print(x.join(''));
        print(x.join(''));
        return;
    }

    if(ones === 1){
        print('NO')
        return;
    }
    var zCount = 0;
    var oCount = 1;

     x = [1];
     y = [1];
     x.push(1);
     addChars(x, 0, k)

     addChars(y, 0, k)
     y.push(1);

     zCount+=k;
     oCount+=1;

     if(zCount > zerous || oCount > ones){
        print('NO')
        return;
     }

    addChars(x, 1, ones - oCount)
    addChars(x, 0, zerous - zCount)

    addChars(y, 1, ones - oCount)
    addChars(y, 0, zerous - zCount)

    print('YES');
    print(x.join(''));
    print(y.join(''));

}

function addChars(arr, ch, n){
    for(var i = 0; i < n; i++){
        arr.push(ch);
    }
}


You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and change the number at the position $$$(i, j)$$$ to any other number in range $$$[1; 9]$$$) to make it anti-sudoku. The anti-sudoku is the $$$9 \times 9$$$ field, in which:  Any number in this field is in range $$$[1; 9]$$$;  each row contains at least two equal elements;  each column contains at least two equal elements;  each $$$3 \times 3$$$ block (you can read what is the block in the link above) contains at least two equal elements. It is guaranteed that the answer exists.You have to answer $$$t$$$ independent test cases.

The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.

For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.

var t = parseInt(readline());

function div(val, by){
    return (val - val % by) / by;
}

function setCharAt(str,index,chr) {
    if(index > str.length-1) return str;
    return str.substr(0,index) + chr + str.substr(index+1);
}

var ch = 'a';
var acode = ch.charCodeAt(0);

for (var tt = 0; tt < t; tt++) {
    var a = [];
    for (var i = 0; i < 9; i++) {
        a.push(readline());
    }

    a[0] = setCharAt(a[0], 0, a[0][1]);
    a[3] = setCharAt(a[3], 1, a[3][2]);
    a[6] = setCharAt(a[6], 2, a[6][3]);

    a[1] = setCharAt(a[1], 3, a[1][4]);
    a[4] = setCharAt(a[4], 4, a[4][5]);
    a[7] = setCharAt(a[7], 5, a[7][6]);

    a[2] = setCharAt(a[2], 6, a[2][7]);
    a[5] = setCharAt(a[5], 7, a[5][8]);
    a[8] = setCharAt(a[8], 8, a[8][0]);

    for (var i = 0; i < 9; i++) {
        write(a[i]+'\n');
    }
    // write(res+'\n');
}

var t = +readline();
while (t--) {
    var s = "";
    for (var i = 0; i < 9; i++) {
        print(readline().replace('1','2'));
    }
}

var t = readline();

while (t--) {
  var sud = new Array(9);

  for (var i = 0; i < 9; i++) {
    sud[i] = readline().split('').map(function (val) {
      return parseInt(val);
    });
  }

  var j = 0;

  for (var _i = 0; _i < 9; _i++) {
    sud[_i][j] = sud[_i][j] % 9 + 1;
    if (j + 3 >= 9) j++;
    j = (j + 3) % 9;
  }

  sud.forEach(function (val) {
    print(val.join(''));
  });
}

var T = parseInt(readline());
while (T--) {

    var input1 = readline().split("").map((x) => parseInt(x));
    var input2 = readline().split("").map((x) => parseInt(x));
    var input3 = readline().split("").map((x) => parseInt(x));
    var input4 = readline().split("").map((x) => parseInt(x));
    var input5 = readline().split("").map((x) => parseInt(x));
    var input6 = readline().split("").map((x) => parseInt(x));
    var input7 = readline().split("").map((x) => parseInt(x));
    var input8 = readline().split("").map((x) => parseInt(x));
    var input9 = readline().split("").map((x) => parseInt(x));

    input1[0] = input1[1];
    input2[3] = input2[4];
    input3[6] = input3[7];

    input4[1] = input4[2];
    input5[4] = input5[5];
    input6[7] = input6[8];

    input7[2] = input7[1];
    input8[5] = input8[4];
    input9[8] = input9[7];

    print(input1.join(""));
    print(input2.join(""));
    print(input3.join(""));
    print(input4.join(""));
    print(input5.join(""));
    print(input6.join(""));
    print(input7.join(""));
    print(input8.join(""));
    print(input9.join(""));
}

var T = parseInt(readline());

for (var p = 0; p < T; p++) {
    for (var q = 0; q < 9; q++) {
        var str = readline();
        print(str.replace("1", "2"));
    }
}

var T = parseInt(readline());
while (T--) {
  var input1 = readline()
    .split("")
    .map((x) => parseInt(x));
  var input2 = readline()
    .split("")
    .map((x) => parseInt(x));
  var input3 = readline()
    .split("")
    .map((x) => parseInt(x));
  var input4 = readline()
    .split("")
    .map((x) => parseInt(x));
  var input5 = readline()
    .split("")
    .map((x) => parseInt(x));
  var input6 = readline()
    .split("")
    .map((x) => parseInt(x));
  var input7 = readline()
    .split("")
    .map((x) => parseInt(x));
  var input8 = readline()
    .split("")
    .map((x) => parseInt(x));
  var input9 = readline()
    .split("")
    .map((x) => parseInt(x));
  input1[0] = input1[1];
  input2[3] = input2[4];
  input3[6] = input3[7];

  input4[1] = input4[2];
  input5[4] = input5[5];
  input6[7] = input6[8];

  input7[2] = input7[1];
  input8[5] = input8[4];
 input9[8] = input9[7];

  print(input1.join(""));
  print(input2.join(""));
  print(input3.join(""));
  print(input4.join(""));
  print(input5.join(""));
  print(input6.join(""));
  print(input7.join(""));
  print(input8.join(""));
  print(input9.join(""));
}

var t = parseInt(readline());

for (var i = 0; i < t; i++) {
    for (var j = 0; j < 9; j++) {
        print(readline().replace('1','2'));
    }
}

var inputs = readline();

for(var k=0;k<inputs;k++) {
    for(var i=0;i<9;i++) {
        var team = readline().split("").map(x => parseInt(x));

        team.splice(team.indexOf(1) , 1, 2);
        print(team.join(""));
    }
}

// const bg = require('big-integer')
process.stdin.resume()
process.stdin.setEncoding('utf-8')

let input = ''
let ptr = 0
process.stdin.on('data', (i) => {
  input += i
})

process.stdin.on('end', () => {
  input = input.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
  main()
})

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if(inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

function readInt() {
  return parseInt(input[ptr++])
}

function readString() {
  return input[ptr++]
}

function readStrings() {
  return input[ptr++].split(' ')
}

function readInts() {
  return input[ptr++].split(' ').map(a => parseInt(a))
}

function main() {
  let t = readInt()
  while(t--) {
    const sudo = new Array(9)
    for(let i = 0; i < 9; i++) {
      sudo[i] = readString().split('')
    }
    sudo[0][0] = sudo[0][1]
    sudo[1][3] = sudo[1][4]
    sudo[2][6] = sudo[2][7]
    sudo[3][1] = sudo[3][2]
    sudo[4][4] = sudo[4][5]
    sudo[5][7] = sudo[5][8]
    sudo[6][2] = sudo[6][0]
    sudo[7][5] = sudo[7][3]
    sudo[8][8] = sudo[8][6]
    for(let i = 0; i < 9; i++) {
      wr(sudo[i].join(''))
    }
  }
}

//DISABLE THIS LINE END ENABLE NEXT
//const rl =  require('readline').createInterface({input: require('fs').createReadStream('input.txt')});
const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout })
const print = console.log
const write = (...args) => {
    process.stdout.write(args.join(' ') );
}
const lines = []
rl.on('line', line => {
    lines.push(line);
});
rl.on('close', main)

let rli = 0;
function readline() {
    return lines[rli++];
}

function main() {
	var y = +readline()
	while(y > 0) {
		var input = [];
		var r = 9;
		var c = 0;
		while(c < r) {
			var row = readline().split('');
			input.push(row);
			c++;
		}
		for(var i = 0; i < r; i++) {
			for(var j = 0; j < 9; j++) {
				if (input[i][j] == '1') {
					input[i][j] = '2';
				}
			}
		}
		for(var i = 0; i < r; i++) {
			if (i < 8 || y > 1) {
				write(input[i].join('') + '\n');
			} else {
				write(input[i].join(''));
			}
		}
		y--;
	}
}

const processData = (input) => {
    let exp = /\s+/;
    let arr = input.split(exp);
    arr = arr.slice(1);
    arr.forEach(element => {
        console.log(element.replace('1', '2'));
    });
}

//console.log(processData("1 154873296 386592714 729641835 863725149 975314628 412968357 631457982 598236471 247189563"));

process.stdin.resume();
process.stdin.setEncoding("ascii");
_input = "";
process.stdin.on("data", function (input) {
    _input += input;
});

process.stdin.on("end", function () {
    processData(_input);
});

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
    console.log(x);
}

let inputString = "";
let currentLine = 0;

process.stdin.on("data", inputStdin => {
    inputString += inputStdin;
});
process.stdin.on("end", () => {
    inputString = inputString.split("\n");
    main();
});
function readline() {
    return inputString[currentLine++];
}

//-----------main fucntion-----------

function main() {
    var T = parseInt(readline());
    while (T--) {
        var n = 9
        while (n--) {
            var input1 = readline()
            print(input1.replace("1", "2"))
        }
    }
}

const processData = (lines) => {
  const num = +lines[0]
  for (let i=0; i<num; i++) {
    const sudoku = []
    for (let j=0; j<9; j++){
      sudoku.push(lines[i*9+j+1].split('').map(x => +x))
    }
    for (let n=0; n<9; n++) {
      const pos = [n, (n*3)%9 + Math.floor(n/3)]
      sudoku[pos[0]][pos[1]] = sudoku[pos[0]][pos[1]] === 1 ? 2 : 1
    }
    for (const s of sudoku) {
      console.log(s.join(''))
    }
  }
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL) /*your input text, split by lines*/
  processData(lines)
})

const init = () => {
  process.stdin.resume();
  process.stdin.setEncoding('utf-8');

  let inputString = '';
  let currentLine = 0;

  process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
  });

  process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
      return string.trim();
    });

    main();
  });

  global.readline = () => {
    return inputString[currentLine++];
  };
};

if (typeof readline === 'undefined') {
  init();
}

const print = (...args) => {
  console.log(...args);
};

const main = () => {
  let t = Number(readline());
  while (t--) {
    const a = Array.from(new Array(9), () => readline().split('').map(x => parseInt(x)));
    const toChange = [
      [0, 0],
      [1, 3],
      [2, 6],
      [3, 1],
      [4, 4],
      [5, 7],
      [6, 2],
      [7, 5],
      [8, 8]];
    const current = toChange.map(([x, y]) => a[x][y]);
    toChange.forEach(([i, j]) => {
      a[i][j] = a[i][(j + 1) % 3 + 3 * Math.floor(j / 3)]
    });
    print(a.map(x => x.join('')).join('\n'))
  }
};

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
  inputString += inputStdin;
});

process.stdin.on('end', _ => {
  inputString = inputString.replace(/\s*$/, '')
    .split('\n')
    .map(str => str.replace(/\s*$/, ''));
  main();
});

function readLine() {
  return inputString[currentLine++];
}

function main() {
  const t = parseInt(readLine());
  for (let i = 0; i < t; i++) {
    // let n = parseInt(readLine());
    let a = new Array(9);
    for (let i = 0; i < 9; i++)
      a[i] = readLine();
    let res = new Array(9).fill('');
    for(let i = 0; i < 9; i++) {
      for (let j = 0; j < 9; j++) {
        if (a[i][j] === '1') res[i] += '2';
        else res[i] += a[i][j];
      }
    }
    for (let i = 0; i < 9; i++) console.log(res[i]);
  }
  //process.stdout.write("hello: ");
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
    let n = parseInt(readline(), 10);

    for (var j = 0; j < n; j++) {
        for (var i = 0; i < 9; i++) {
            console.log(readline().replace(/8/g, '3'));
        }
    }

}

function tpp(x) {
    return (x ==='9') ? '1' : x + 1;
}

var t = +readline();
while (t--) {
    var s = "";
    for (var i = 0; i < 9; i++) {
        s = readline();
        s.replace('1','2');
        print(s);
    }
}

var t = readline();

while (t--) {
  var sud = new Array(9);

  for (var i = 0; i < 9; i++) {
    sud[i] = readline().split('').map(function (val) {
      return parseInt(val);
    });
  }

  for (var _i = 0; _i < 9; _i++) {
    sud[_i][_i] = sud[_i][_i] % 9 + 1;
  }

  sud.forEach(function (val) {
    print(val.join(''));
  });
}

var t = parseInt(readline());

function mapper(num) {
    return +num;
}

for (var i = 0; i < t; i++) {

    for (var j = 0; j < 9; j++) {
        var row = readline().split('');
        if (row[j] === '1') {
            row[j] = '9';
        } else {
            row[j] = '1';
        }
        print(row.join(''));
    }
}

var inputs = readline();

for(var k=0;k<inputs;k++) {
    for(var i=0;i<9;i++) {
        var team = readline().split("").map(x => parseInt(x));

        if(team[i] === 9) {
            team[i] = team[i] - 1;
        } else {
            team[i] = team[i] + 1;

        }
        print(team.join(""));
    }
}

var inputs = readline();

for(var k=0;k<inputs;k++) {
    for(var i=0;i<9;i++) {
        var team = readline().split("").map(x => parseInt(x));
        if(i === 8) {
            team[i-1] = team[i];
        } else {
            team[i+1] = team[i];
        }
        print(team.join(""));
    }
}

// const bg = require('big-integer')
process.stdin.resume()
process.stdin.setEncoding('utf-8')

let input = ''
let ptr = 0
process.stdin.on('data', (i) => {
  input += i
})

process.stdin.on('end', () => {
  input = input.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
  main()
})

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if(inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

function readInt() {
  return parseInt(input[ptr++])
}

function readString() {
  return input[ptr++]
}

function readStrings() {
  return input[ptr++].split(' ')
}

function readInts() {
  return input[ptr++].split(' ').map(a => parseInt(a))
}

function main() {
  let t = readInt()
  while(t--) {
    const sudo = new Array(9)
    for(let i = 0; i < 9; i++) {
      sudo[i] = readString().split('')
    }
    sudo[0][0] = sudo[0][1]
    sudo[1][3] = sudo[1][4]
    sudo[2][6] = sudo[2][7]
    sudo[3][1] = sudo[3][2]
    sudo[4][4] = sudo[4][5]
    sudo[5][7] = sudo[5][8]
    sudo[6][2] = sudo[6][0]
    sudo[7][5] = sudo[7][3]
    sudo[8][8] = sudo[8][6]
    for(let i = 0; i < 9; i++) {
      wr(sudo[i].join(' '))
    }
  }
}

const processData = (input) => {
    let exp = /\s+/;
    let arr = input.split(exp);
    arr = arr.slice(1);
    arr.array.forEach(element => {
        console.log(element.replace('1','2'));
    });
}

const processData = (input) => {
    let exp = /\s+/;
    let arr = input.split(exp);
    arr = arr.slice(1);
    arr.forEach(element => {
        console.log(element.replace('1','2'));
    });
}

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
    console.log(x);
}

let inputString = "";
let currentLine = 0;

process.stdin.on("data", inputStdin => {
    inputString += inputStdin;
});
process.stdin.on("end", () => {
    inputString = inputString.split("\n");
    main();
});
function readline() {
    return inputString[currentLine++];
}

//-----------main fucntion-----------

function main() {
    var T = parseInt(readline());
    while (T--) {
        var n = 9
        while (n--) {
            var input1 = readline().split('').map(x => parseInt(x));
            var index = input1.indexOf(1)
            input1[index] = 2
            print(input1.join(''))
        }

    }

}

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
    console.log(x);
}

let inputString = "";
let currentLine = 0;

process.stdin.on("data", inputStdin => {
    inputString += inputStdin;
});
process.stdin.on("end", () => {
    inputString = inputString.split("\n");
    main();
});
function readline() {
    return inputString[currentLine++];
}

//-----------main fucntion-----------

function main() {
    var T = parseInt(readline());
    while (T--) {
        var input1 = readline().split('').map(x => parseInt(x));
        var input2 = readline().split('').map(x => parseInt(x));
        var input3 = readline().split('').map(x => parseInt(x));
        var input4 = readline().split('').map(x => parseInt(x));
        var input5 = readline().split('').map(x => parseInt(x));
        var input6 = readline().split('').map(x => parseInt(x));
        var input7 = readline().split('').map(x => parseInt(x));
        var input8 = readline().split('').map(x => parseInt(x));
        var input9 = readline().split('').map(x => parseInt(x));
        input1[0] = input1[1]
        input2[3] = input2[4]
        input3[6] = input3[7]

        input4[1] = input4[2]
        input5[4] = input5[5]
        input6[7] = input6[8]

        input7[2] = input7[1]
        input8[5] = input8[4]
        input9[8] = input9[7]
        print(input1.join())
        print(input2.join())
        print(input3.join())
        print(input4.join())
        print(input5.join())
        print(input6.join())
        print(input7.join())
        print(input8.join())
        print(input9.join())

    }

}

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
    console.log(x);
}

let inputString = "";
let currentLine = 0;

process.stdin.on("data", inputStdin => {
    inputString += inputStdin;
});
process.stdin.on("end", () => {
    inputString = inputString.split("\n");
    main();
});
function readline() {
    return inputString[currentLine++];
}

//-----------main fucntion-----------

function main() {
    var T = parseInt(readline());
    while (T--) {
        var input1 = readline().split('').map(x => parseInt(x));
        var input2 = readline().split('').map(x => parseInt(x));
        var input3 = readline().split('').map(x => parseInt(x));
        var input4 = readline().split('').map(x => parseInt(x));
        var input5 = readline().split('').map(x => parseInt(x));
        var input6 = readline().split('').map(x => parseInt(x));
        var input7 = readline().split('').map(x => parseInt(x));
        var input8 = readline().split('').map(x => parseInt(x));
        var input9 = readline().split('').map(x => parseInt(x));
        input1[1]=input1[0]
        input2[4]=input2[3]
        input3[7]=input3[6]

        input4[1]=input4[0]
        input5[4]=input5[3]
        input6[7]=input6[6]

        input7[1]=input7[0]
        input8[4]=input8[3]
        input9[7]=input9[6]
        print(input1)
        print(input2)
        print(input3)
        print(input4)
        print(input5)
        print(input6)
        print(input7)
        print(input8)
        print(input9)

    }

}

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
    console.log(x);
}

let inputString = "";
let currentLine = 0;

process.stdin.on("data", inputStdin => {
    inputString += inputStdin;
});
process.stdin.on("end", () => {
    inputString = inputString.split("\n");
    main();
});
function readline() {
    return inputString[currentLine++];
}

//-----------main fucntion-----------

function main() {
    var T = parseInt(readline());
    while (T--) {
        var input1 = readline().split('').map(x => parseInt(x));
        var input2 = readline().split('').map(x => parseInt(x));
        var input3 = readline().split('').map(x => parseInt(x));
        var input4 = readline().split('').map(x => parseInt(x));
        var input5 = readline().split('').map(x => parseInt(x));
        var input6 = readline().split('').map(x => parseInt(x));
        var input7 = readline().split('').map(x => parseInt(x));
        var input8 = readline().split('').map(x => parseInt(x));
        var input9 = readline().split('').map(x => parseInt(x));
        input1[0] = input1[1]
        input2[3] = input2[4]
        input3[6] = input3[7]

        input4[1] = input4[2]
        input5[4] = input5[5]
        input6[7] = input6[8]

        input7[2] = input7[1]
        input8[5] = input8[4]
        input9[8] = input9[7]
        print(input1.join(''))
        print(input2.join(''))
        print(input3.join(''))
        print(input4.join(''))
        print(input5.join(''))
        print(input6.join(''))
        print(input7.join(''))
        print(input8.join(''))
        print(input9.join(''))

    }

}

const init = () => {
  process.stdin.resume();
  process.stdin.setEncoding('utf-8');

  let inputString = '';
  let currentLine = 0;

  process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
  });

  process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
      return string.trim();
    });

    main();
  });

  global.readline = () => {
    return inputString[currentLine++];
  };
};

if (typeof readline === 'undefined') {
  init();
}

const print = (...args) => {
  console.log(...args);
};

const main = () => {
  let t = Number(readline());
  while (t--) {
    const a = Array.from(new Array(9), () => readline().split('').map(x => parseInt(x)));
    const toChange = [
      [0, 0],
      [1, 3],
      [2, 6],
      [3, 1],
      [4, 4],
      [5, 7],
      [6, 2],
      [7, 5],
      [8, 8]];
    const current = toChange.map(([x, y]) => a[x][y]);
    toChange.forEach(([i, j]) => {
      a[i][j] = a[(i + 1) % 9][(j + 1) % 9]
    });
    print(a.map(x => x.join('')).join('\n'))
  }
};

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
  inputString += inputStdin;
});

process.stdin.on('end', _ => {
  inputString = inputString.replace(/\s*$/, '')
    .split('\n')
    .map(str => str.replace(/\s*$/, ''));
  main();
});

function readLine() {
  return inputString[currentLine++];
}

function main() {
  const t = parseInt(readLine());
  for (let i = 0; i < t; i++) {
    // let n = parseInt(readLine());
    let a = new Array(9);
    for (let i = 0; i < 9; i++)
      a[i] = readLine();
    let res = new Array(9).fill('');
    for(let i = 0; i < 9; i++) {
      for (let j = 0; j < 9; j++) {
        if (i === j) {
          let char = parseInt(a[i][j]) + 1;
          if (char === 10) char = 1;
          res[i] += char;
        }
        res[i] += a[i][j];
      }
    }
    for (let i = 0; i < 9; i++) console.log(res[i]);
  }
  //process.stdout.write("hello: ");
}