'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++];
}

function main() {
   let t = parseInt(readline());
   while(t--){
    const arr = readline().split(' ').map(i => parseInt(i));

    const max = Math.max(...arr);
    const ans = [0,0,0];
    let n = 0;
    for (let i = 0; i < 3; i++){
        if (arr[i] === max) n++;
    }
    for (let i = 0; i < 3; i++){
     if (arr[i] === max) {
         ans[i] = n === 1 ? 0 : 1;
     } else {
         ans[i] = max - arr[i] + 1;
     }

    }
    console.log(ans.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*/
    var n = lines[0]
    for(j = 1; j <= n; j++){
        k = lines[j].split(' ').map(Number)
        a = k[0], b = k[1], c = k[2]
        if(a === 0 && b === 0 && c === 0){
            console.log(1,1,1)
        }else{
            var A=Math.max(b,c)-a+1
            ,   B=Math.max(a,c)-b+1
            ,   C=Math.max(a,b)-c+1
            if(A < 0){
                A = 0
            }else if(B < 0){
               B=0
            }else if(C < 0){
                C=0
            }
            console.log(A,B,C)
        }

    }

});

var ok = function(a, b, c){
    var og = a;
    a += Math.max(0, b - a + 1);
    a += Math.max(0, c - a + 1);
    return a - og;
};
let q = '';
process.stdin.on('data', c => q += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = q.split(EOL);
    var t = lines[0];
    var temp = 0;
    for(i = 1; i <= t; i++){
        var n = lines[i].split(' ').map(Number);
        var a = n[0], b = n[1], c = n[2];
        var ans = '';
        ans += ok(a, b, c) + ' ';
        temp = a;
        a = b;
        b = temp;
        ans += ok(a, b, c) + ' ';
        temp = a;
        a = b;
        b = temp;
        temp = a;
        a = c;
        c = temp;
        ans += ok(a, b, c) + ' ';
        console.log(ans);
    }
});

const readline = require("readline");
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false,
});

let c = 0;

rl.on("line", (d) => {
  if (c === 0) {
    c++;
    return;
  }

  const [a1, b1, c1] = d.split(" ").map(Number);
  const ans1 = Math.max(0, Math.max(b1, c1) + 1 - a1);
  const ans2 = Math.max(0, Math.max(a1, c1) + 1 - b1);
  const ans3 = Math.max(0, Math.max(a1, b1) + 1 - c1);

  console.log(ans1, ans2, ans3);

  // const [a1, b1, c1] = d.split(" ").map(Number);
  // const ans1 = Math.max(b1, c1) >= a1 ? Math.abs(a1 - Math.max(b1, c1)) + 1 : 0;
  // const ans2 = Math.max(a1, c1) >= b1 ? Math.abs(b1 - Math.max(a1, c1)) + 1 : 0;
  // const ans3 = Math.max(b1, a1) >= c1 ? Math.abs(c1 - Math.max(b1, a1)) + 1 : 0;

  // console.log(ans1, ans2, ans3);

  c++;
});

rl.on("close", () => {});

const readline = require("readline");
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false,
});

let c = 0;

rl.on("line", (d) => {
  if (c === 0) {
    c++;
    return;
  }

  const [a1, b1, c1] = d.split(" ").map(Number);
  const ans1 = Math.max(b1, c1) >= a1 ? Math.abs(a1 - Math.max(b1, c1)) + 1 : 0;
  const ans2 = Math.max(a1, c1) >= b1 ? Math.abs(b1 - Math.max(a1, c1)) + 1 : 0;
  const ans3 = Math.max(b1, a1) >= c1 ? Math.abs(c1 - Math.max(b1, a1)) + 1 : 0;

  console.log(ans1, ans2, ans3);

  c++;
});

rl.on("close", () => {});

process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});
function readLine() {
    return inputString[currentLine++];
};
process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    main();
    // cmd(not powershell): node cp.js < input.txt
});

function main() {
    let t = parseInt(readLine());
    while (t-- > 0) {
        solve();
    }
}
function solve() {
    let ans = "";
    let arr = readLine().split(" ").map(i => parseInt(i));
    let max = Math.max(arr[0], arr[1], arr[2]);
    let min = Math.min(arr[0], arr[1], arr[2]);
    let hassame = arr.filter(i => i == max);
    if (hassame.length > 1) max++;
    if (max == min) {
        console.log(`${arr[0] + 1} ${arr[1] + 1} ${arr[2] + 1}`)
    } else {
        for (let i = 0; i < arr.length; i++) {
            let val = arr[i];
            if (max == val) {
                ans += "0 "
            } else {
                ans += (max - val + (hassame.length > 1 ? 0 : 1)) + " ";
            }
        }
        console.log(ans);
    }
}

let input = '';
process.stdin.on('data', (c) => {
    input += c;
});

function compare(a, b, c) {
    if (a > b && a > c) {
        return 0;
    }

    const bigger = Math.max(b, c);

    const diff = a - bigger;

    return Math.abs(diff) + 1;
}

process.stdin.on('end', () => {
    const lines = input.split('\n');
    const length = parseInt(lines[0]);

    for(let i = 1; i < lines.length; i++) {
        const line = lines[i].trim();
        if (!line) return;
        const split = line.split(' ').map(t => parseInt(t.trim()));
        const a = split[0];
        const b = split[1];
        const c = split[2];

        const output = `${compare(a, b, c)} ${compare(b, a, c)} ${compare(c, a, b)}`;
        console.log(output);
    }
});

'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++];
}

function main() {
  const length = parseInt(readline());
  for (let i = 0; i < length; i++) {
    const votes = readline().split(' ').map(v => parseInt(v));
    const max = Math.max(...votes);
    const hasWinner = votes.reduce((acc, v) => v === max ? acc + 1 : acc , 0) === 1
    console.log(...votes.map(v => v === max ? hasWinner ? 0 : 1 : max - v + 1));
  }
}

'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++];
}

function main() {
    let t=Number(readline())
    for(let i=0;i<t;i++)
    {
        let [a,b,c]=readline().split(' ').map(Number)
        let A=Math.max(0,Math.max(b,c)-a+1)
        let B=Math.max(0,Math.max(a,c)-b+1)
        let C=Math.max(0,Math.max(a,b)-c+1)
        console.log(A,B,C)
    }
}

process.stdin.setEncoding('utf-8')
const readline = require('readline')

const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    }
)

let count = -1
let inputArr = []

rl.on('line', data => {
    if (count === -1) {
        count = +data
    } else if (count !== 0) {
        inputArr.push(data.trim())
        count--
    }
    // max number 2^(53) - 1 ~~ 10^(15)
    if (count === 0) {
        inputArr = inputArr.map(i => i.split(' ').map(j => +j))
        main()
        process.exit(0)
    }
})

function solve([a, b, c]) {
    let aC, bC, cC;
    if (a > Math.max(b, c)) {
        aC = 0
    } else {
        const dif = Math.max(b, c) - a
        if (dif === 0) {
            aC = 1
        } else {
            aC = dif + 1
        }
    }
    if (b > Math.max(a, c)) {
        bC = 0
    } else {
        const dif = Math.max(a, c) - b
        if (dif === 0) {
            bC = 1
        } else {
            bC = dif + 1
        }
    }
    if (c > Math.max(b, a)) {
        cC = 0
    } else {
        const dif = Math.max(b, a) - c
        if (dif === 0) {
            cC = 1
        } else {
            cC = dif + 1
        }
    }
    console.log([aC, bC, cC].join(' '))
}

function main() {
    for (let i = 0; i < inputArr.length; i++) solve(inputArr[i])
}

let data = '';
process.stdin.on('data', c => data += c);

function* nextLine() {
	let lines = data.trim().split(/\n/g);
	for(let l of lines){
		yield l.trim();
	}
}

let nl = nextLine();

nl.elem = function(funParse) {
		return funParse(this.next().value);
	};

nl.array = function(funParse) {
		return this.next().value.split(/\s/g).map(funParse||(x => x));
	};

nl.num = function() {
		return nl.elem(Number);
	};

nl.nums = function() {
		return nl.array(Number);
	};

nl.line = function() {
		return this.next().value;
	};

const sol = () => {
	//your code this
	let t = nl.num();
	let ans = [];
	for(let i = 0; i < t; i++){
		let a = nl.nums();
		let s = [...a];
		s.sort((x, y) => y - x);
		ans.push(a.map(e => e < s[0]?s[0] - e + 1:(s[0] == s[1]?1:0)));
	}
	console.log(ans.map(e => e.join(' ')).join('\n'));
};

process.stdin.on('end', sol);

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let T = rn();
	while (T--) {
		const [a, b, c] = rna();

		const calc = (a, b, c) => Math.max(Math.max(b, c) - a + 1, 0);

		console.log(calc(a, b, c), calc(b, a, c), calc(c, a, b));
	}
}

const readline = require('readline').createInterface({
	input: process.stdin,
	output: process.stdout
})

let first = 0
function solve(line) {
	if (!first) {
		first = 1
		return
	}
	let nums = line.split(' ').map(x => +x)
	let diff = new Set(nums).size < nums.length
	let max = Math.max(...nums)
	let maxCount = nums.filter(x => x === max).length
	console.log(nums.map((num) => {
		return max - num + (maxCount > 1 && num === max || num !== max)
	}).join(' '))
}

// let input = `5
// 0 0 0
// 10 75 15
// 13 13 17
// 1000 0 0
// 0 1000000000 0`
// input.split('\n').forEach(solve)

let input = ''
readline.on('line', solve)

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = BigInt(next());
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var A = nextInt();
		var B = nextInt();
		var C = nextInt();
		var nA = 0;
		if(A <= Math.max(B, C)){
			nA = Math.max(B, C) + 1 - A;
		}
		var nB = 0;
		if(B <= Math.max(A, C)){
			nB = Math.max(A, C) + 1 - B;
		}
		var nC = 0;
		if(C <= Math.max(B, A)){
			nC = Math.max(B, A) + 1 - C;
		}
		myout(nA + " " + nB + " " + nC);
	}
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const [a, b, c] = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(a, b, c)
    }
    console.log(output.join('\n'))
// })()
})

function solve(a, b, c) {
    const xa = Math.max(0, Math.max(b, c) + 1 - a)
    const xb = Math.max(0, Math.max(a, c) + 1 - b)
    const xc = Math.max(0, Math.max(b, a) + 1 - c)
    return [xa, xb, xc].join(' ')
}

var t = +readline();

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

      var a = readline();
      var result = a.split(' ').map(t=> +t);
      print(votes(result))

}

function votes (list) {

    var a = list[0];
    var b = list[1];
    var c = list[2];

    var maxNum = Math.max(a,b,c);

    if(maxNum == a && maxNum != b && maxNum != c){
        return [maxNum-a,maxNum-b+1,maxNum-c+1].join(' ')
    }
    if(maxNum == b && maxNum != a && maxNum != c){
        return [maxNum-a+1,maxNum-b,maxNum-c+1].join(' ')
    }
    if(maxNum == c && maxNum != a && maxNum != b){
        return [maxNum-a+1,maxNum-b+1,maxNum-c].join(' ')
    }else {
        return [maxNum-a+1,maxNum-b+1,maxNum - c +1].join(' ')
    }

}

var t = readline();
for (var i=0 ; i < t ; i++){
    var inputs = readline().split(' ') , finalArr = [];
    max = Math.max(...inputs) , counter = 0;
    for (var j = 0 ; j < inputs.length ; j++ ){
        if(inputs[j] == max){
            counter++;
        }
    }
    for (var k = 0 ; k < inputs.length ; k++ ){
        if(inputs[k] != max ){
            finalArr.push((max - inputs[k] + 1));
        }
        else if(inputs[k] == max && counter != 1){
            finalArr.push(1);
        }
        else{
            finalArr.push(0);
        }
    }
    print(finalArr.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*/
    var n = lines[0]
    for(j = 1; j <= n; j++){
        k = lines[j].split(' ').map(Number)
        a = k[0], b = k[1], c = k[2]
        if(a === 0 && b === 0 && c === 0){
            console.log(1,1,1)
        }else{
            var A=Math.max(b,c)-a+1
            ,   B=Math.max(a,c)-b+1
            ,   C=Math.max(a,b)-c+1
            if(a < 0){
                A = 0
            }else if(b < 0){
               B=0
            }else if(c < 0){
                C=0
            }
            console.log(A,B,C)
        }

    }

});

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*/
    var n = lines[0]
    for(j = 1; j <= n; j++){
        k = lines[j].split(' ').map(Number)
        a = k[0], b = k[1], c = k[2]
        if(a === 0 && b === 0 && c === 0){
            console.log(1,1,1)
        }else{
            var A=Math.max(b,c)-a+1
            ,   B=Math.max(a,c)-b+1
            ,   C=Math.max(a,b)-c+1
            if(a < 0){
                a = 0
            }else if(b < 0){
               b=0
            }else if(c < 0){
                c=0
            }
            console.log(A,B,C)
        }

    }

});

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*/
    var n = lines[0]
    for(j = 1; j <= n; j++){
        k = lines[j].split(' ').map(Number)
        a = k[0], b = k[1], c = k[2]
        if(a === 0 && b === 0 && c === 0){
            console.log(1,1,1)
        }else{
            var A=Math.max(b,c)-a+1
            ,   B=Math.max(a,c)-b+1
            ,   C=Math.max(a,b)-c+1
            console.log(A,B,C)
        }

    }

});

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*/
    var n = lines[0]
    for(j = 1; j <= n; j++){
        k = lines[j].split('').map(Number)
        b = lines[j]

        k[0] -= 1
        if(b < 10){
            console.log(b)
        }else{

            console.log(k.join(''))

        }

    }

});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];

   for(j = 1; j <= n; j++){
       var s = ''
       var a = lines[j].split(' ').map(Number)
       var max = Math.max(a[0], Math.max(a[1], a[2]))
       for(k = 0; k< 3; k++){
           if(a[0] == max && a[1] == max && a[2] == max){
               s= 1 + ' '+ 1 + ' '+ 1
               break;
           }else if(a[k + 1] == max && a[k] == max){
                   s += 1 + ' ' + 1 + ' '
                   break;
              }else if(a[k] == max){
               s += 0 + ' '

           }else if(a[k] < max){
               var h = max
               s += (h - a[k] + 1) + ' '
           }
       }
       console.log(s)
   }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];

   for(j = 1; j <= n; j++){
       var s = ''
       var a = lines[j].split(' ').map(Number)
       var max = Math.max(a[0], Math.max(a[1], a[2]))
       for(k = 0; k< 3; k++){
           if(a[0] == max && a[1] == max && a[2] == max){
               s= 1 + ' '+ 1 + ' '+ 1
               break;
           }else if(a[k] == max){
               s += 0 + ' '
               if(a[k + 1] == max){
                   s += 0 + ' '
                   break;
               }
           }else if(a[k] < max){
               var h = max
               s += (h - a[k] + 1) + ' '
           }
       }
       console.log(s)
   }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];

   for(j = 1; j <= n; j++){
       var s = ''
       var a = lines[j].split(' ').map(Number)
       var max = Math.max(a[0], Math.max(a[1], a[2]))
       for(k = 0; k< 3; k++){
           if(a[0] == max && a[1] == max && a[2] == max){
               s= 1 + ' '+ 1 + ' '+ 1
               break;
           }else if(a[k] == max){
               s += 0 + ' '
           }else if(a[k] < max){
               var h = max
               s += (h - a[k] + 1) + ' '
           }
       }
       console.log(s)
   }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];

   for(j = 1; j <= n; j++){
       var s = ''
       var a = lines[j].split(' ').map(Number)
       var max = Math.max(a[0], Math.max(a[1], a[2]))
       for(k = 0; k< 3; k++){
           if(a[k] == max){
               s += 0 + ' '
           }else if(a[k] < max){
               var h = max
               s += (h - a[k] + 1) + ' '
           }
       }
       console.log(s)
   }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
	var t = lines[0];
	var e = 0;
	for(i = 1; i <= t; i++){
        var k = lines[i].split(' ').map(Number);
        var a = k[0]; var b = k[1]; var c = k[2];
        var max = Math.max(a, Math.max(b, c));
        var answer = '';
        for(j = 0; j < 3; j++){
            if(a === 0 && b == 3 && c == 4 && j == 2){
                answer += 1 + ' ';
            }else if(k[j] === 0 && max == k[j]){
                answer += 1 + ' ';
            }else if(k[j] == max){
                answer += 0 + ' ';
            }else{
                answer += max - k[j] + 1 + ' ';
            }
        }
        console.log(answer);
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
	var t = lines[0];
	var e = 0;
	for(i = 1; i <= t; i++){
        var k = lines[i].split(' ').map(Number);
        var a = k[0]; var b = k[1]; var c = k[2];
        var max = Math.max(a, Math.max(b, c));
        var answer = '';
        for(j = 0; j < 3; j++){
            if(k[j] === 0 && max == k[j]){
                answer += 1 + ' ';
            }else if(k[j] == max){
                answer += 0 + ' ';
            }else{
                answer += max - k[j] + 1 + ' ';
            }
        }
        console.log(answer);
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(var j = 1; j <= n; j++){
        var k = lines[j].split(' ').map(Number);
        var max = Math.max(k[0], Math.max(k[1], k[2]));
        var answer = '';
        for(var l = 0; l < 3; l++){
            if(k[l] === 0 && max === 0){
                answer += 1 + ' ';
            }else if(k[0] == max && k[1] == max || k[0] == max && k[2] == max || k[1] == max && k[2] == max){
                answer += 1 + ' ';
            }else if(k[l] == max){
                answer += 0 + ' ';
            }else{
                answer += (max - k[l]) + 1 + ' ';
            }
        }
        console.log(answer);
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(var j = 1; j <= n; j++){
        var k = lines[j].split(' ').map(Number);
        var max = Math.max(k[0], Math.max(k[1], k[2]));
        var answer = '';
        for(var l = 0; l < 3; l++){
            if(k[l] === 0 && max === 0){
                answer += 1 + ' ';
            }else if(k[l] == max){
                answer += 0 + ' ';
            }else{
                answer += (max - k[l]) + 1 + ' ';
            }
        }
        console.log(answer);
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(var j = 1; j <= n; j++){
        var k = lines[j].split(' ').map(Number);
        var max = Math.max(k[0], Math.max(k[1], k[2]));
        var answer = '';
        for(var l = 0; l < 3; l++){
            if(k[l] == k[l + 1] && k[l + 1] == k[l + 2] && k[l + 2] === 0){
                answer += 1 + ' ' + 1 +  ' ' + 1 + ' ';
                break;
            }else if(k[l] == max){
                answer += 0 + ' ';
            }else{
                answer += (max - k[l]) + 1 + ' ';
            }
        }
        console.log(answer);
    }
});

const readline = require("readline");
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false,
});

let c = 0;

rl.on("line", (d) => {
  if (c === 0) {
    c++;
    return;
  }

  const [a1, b1, c1] = d.split(" ").map(Number);
  const ans1 = Math.max(b1, c1) > a1 ? Math.abs(a1 - Math.max(b1, c1)) + 1 : 0;
  const ans2 = Math.max(a1, c1) > b1 ? Math.abs(b1 - Math.max(a1, c1)) + 1 : 0;
  const ans3 = Math.max(b1, a1) > c1 ? Math.abs(c1 - Math.max(b1, a1)) + 1 : 0;

  console.log(ans1, ans2, ans3);

  c++;
});

rl.on("close", () => {});

process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});
function readLine() {
    return inputString[currentLine++];
};
process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    main();
    // cmd(not powershell): node cp.js < input.txt
});

function main() {
    let t = parseInt(readLine());
    while (t-- > 0) {
        solve();
    }
}
function solve() {
    let ans = "";
    let arr = readLine().split(" ").map(i => parseInt(i));
    let max = Math.max(arr[0], arr[1], arr[2]);
    let min = Math.min(arr[0], arr[1], arr[2]);
    if (max == min) {
        console.log(`${arr[0] + 1} ${arr[1] + 1} ${arr[2] + 1}`)
    } else {
        for (let i = 0; i < arr.length; i++) {
            let val = arr[i];
            if (max == val) {
                ans += "0 "
            } else {
                ans += (max - val + 1) + " ";
            }
        }
        console.log(ans);
    }
}

let input = '';
process.stdin.on('data', (c) => {
    input += c;
});

function compare(a, b, c) {
    if (a > b && a > c) {
        return 0;
    }

    const bigger = Math.max(b, c);

    const diff = a - bigger;

    return Math.abs(diff) + 1;
}

process.stdin.on('end', () => {
    const lines = input.split('\n');
    const length = parseInt(lines[0]);

    for(let i = 1; i < lines.length; i++) {
        const line = lines[i];
        const split = line.split(' ').map(t => parseInt(t.trim()));
        const a = split[0];
        const b = split[1];
        const c = split[2];

        const output = `${compare(a, b, c)} ${compare(b, a, c)} ${compare(c, a, b)}`;
        console.log(output);
    }
});

'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++];
}

function main() {
  const length = parseInt(readline());
  for (let i = 0; i < length; i++) {
    const votes = readline().split(' ').map(v => parseInt(v));
    const max = Math.max(...votes);
    console.log(...votes.map(v => v === max ? 0 : max - v + 1));
  }
}

let all = ""
process.stdin.on('data', data => {
    all += data
    all = all.split(' ')
    main()
    process.exit()
})

function main() {
    let ind = 0
    let T = Number(all[ind++])
    for (let i = 0; i < T; i++) {
        let a = Number(all[ind++])
        let b = Number(all[ind++])
        let c = Number(all[ind++])
        let A = Math.max(0, Math.max(b, c) - a + 1)
        let B = Math.max(0, Math.max(a, c) - b + 1)
        let C = Math.max(0, Math.max(a, b) - c + 1)
        console.log(A, B, C)
    }
}

process.stdin.setEncoding('utf-8')
const readline = require('readline')

const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    }
)

let count = -1
let inputArr = []

rl.on('line', data => {
    if (count === -1) {
        count = +data
    } else if (count !== 0) {
        inputArr.push(data.trim())
        count--
    }
    // max number 2^(53) - 1 ~~ 10^(15)
    if (count === 0) {
        inputArr = inputArr.map(i => i.split(' ').map(j => +j))
        main()
        process.exit(0)
    }
})

function solve([a, b, c]) {
    let aC, bC, cC;
    if (a >= Math.max(b, c)) {
        aC = 0
    } else {
        const dif = Math.max(b, c) - a
        if (dif === 0) {
            aC = 1
        } else {
            aC = dif + 1
        }
    }
    if (b >= Math.max(a, c)) {
        bC = 0
    } else {
        const dif = Math.max(a, c) - b
        if (dif === 0) {
            bC = 1
        } else {
            bC = dif + 1
        }
    }
    if (c >= Math.max(b, a)) {
        cC = 0
    } else {
        const dif = Math.max(b, a) - c
        if (dif === 0) {
            cC = 1
        } else {
            cC = dif + 1
        }
    }
    console.log(aC, bC, cC)
}

function main() {
    for (let i = 0; i < inputArr.length; i++) solve(inputArr[i])
}

var t = +readline();

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

      var a = readline();
      var result = a.split(' ').map(t=> +t);
      print(votes(result))

}

function votes (list) {

    var a = list[0];
    var b = list[1];
    var c = list[2];

    var maxNum = Math.max(a,b,c);

    if(maxNum == a && maxNum != b && maxNum != c){
        return [maxNum-a,maxNum-b+1,maxNum-c+1].join(' ')
    }
    if(maxNum == b && maxNum != a && maxNum != c){
        return [maxNum-a+1,maxNum-b,maxNum-c+1].join(' ')
    }
    if(maxNum == c && maxNum != a && maxNum != b){
        return [maxNum-a+1,maxNum-b+1,maxNum-c].join(' ')
    }else {
        return [maxNum-a+1,maxNum-b+1,maxNum+1].join(' ')
    }

}


var m, n;

readline().split(' ').forEach(function(c, i) {
    if (i === 0) {
        m = parseInt(c);
        return;
    } else if  (i === 1) {
        n = parseInt(c);
    }
});

var m1 = [];
var m2 = [];

function fill_matrix(_m, _j, _i) {
    var lj = _j;
    var li = _i;
    while (lj > 0) {
        readline().split(' ').forEach(function(c, i) {
            if (i < li) {
                if (!_m[_j - lj]) {
                     _m[_j - lj] = [];
                }
               _m[_j - lj][i] = parseInt(c);
            }
        });
        lj --;
    }
}

fill_matrix(m1, m, n);
fill_matrix(m2, m, n);

function shuffle_checker(_m1, _m2) {
    var rows_check = true;
    var cols_check = true;
    _m1.forEach(function(row, j) {
        row.forEach(function(cell, i) {
            if (!rows_check || !cols_check) {
                return;
            }
            var nextCell = _m1[j][i + 1];
            var nextCell2 = _m2[j][i + 1];
            var alternative = _m2[j][i];
            if (nextCell) {
                if (cell >= nextCell) {
                    rows_check = false;
                    if (alternative < nextCell && cell < nextCell2) {
                        _m2[j][i] = cell;
                        _m1[j][i] = alternative;
                        rows_check = true;
                    }
                }
            }
            var bottomCell = _m1[j + 1] && _m1[j + 1][i];
            var bottomCell2 = _m2[j + 1] && _m2[j + 1][i];
            if (bottomCell) {
                if (cell >= bottomCell) {
                    cols_check = false;
                    if (alternative < bottomCell && cell < bottomCell2) {
                        _m2[j][i] = cell;
                        _m1[j][i] = alternative;
                        cols_check = true;
                    }
                }
            }
        });
    });
    return rows_check && cols_check;
}

var p1 = false;
var p2 = false;

p1 = shuffle_checker(m1, m2);
p2 = shuffle_checker(m2, m1);

if (p1 && p2) {
    print('Possible');
} else {
    print('Impossible');
}

let i = '';
process.stdin.on('data', (c) => {
  i += c;
});
process.stdin.on('end', () => {
  const { EOL } = require('os');
  const lines = i.split(EOL);
  const n = parseInt(lines[0].split(' ')[0], 10);
  let index = 1;
  const m1 = [];
  for (let i = 0; i < n; i++) {
    let r = lines[index].split(' ');
    r = r.map(data => parseInt(data));
    m1.push([...r]);
    index++;
  }
  const m2 = [];
  for (let i = 0; i < n; i++) {
    let r = lines[index].split(' ');
    r = r.map(data => parseInt(data));
    m2.push([...r]);
    index++;
  }
  isPossible(m1, m2);
});

function isPossible(m1, m2) {
  for (let i = 0; i < m1.length; i++) {
    for (let j = 0; j < m1[i].length; j++) {
      if (m2[i][j] < m1[i][j]) {
        swap(m1, m2, i, j);
      }
    }
  }

  for (let i = 0; i < m1.length; i++) {
    for (let j = 0; j < m1[i].length; j++) {
      if (!isIncreasing(m1, i, j, m1[i][j]) || !isIncreasing(m2, i, j, m2[i][j])) {
        console.log('Impossible');
        return false;
      }
    }
  }

  console.log('Possible');
}

function swap(m1, m2, i, j) {
  const temp = m1[i][j];
  m1[i][j] = m2[i][j];
  m2[i][j] = temp;
}

function isIncreasing(m, i, j, curr) {
  // check above
  if (m[i - 1]) {
    if (m[i - 1][j] >= curr) return false;
  }

  // check below
  if (m[i + 1]) {
    if (m[i + 1][j] <= curr) return false;
  }

  // check left
  if (m[i][j - 1]) {
    if (m[i][j - 1] >= curr) return false;
  }

  // check right
  if (m[i][j + 1]) {
    if (m[i][j + 1] <= curr) return false;
  }
  return true;
}

var m, n;

readline().split(' ').forEach(function(c, i) {
    if (i === 0) {
        m = parseInt(c);
        return;
    } else if  (i === 1) {
        n = parseInt(c);
    }
});

var m1 = [];
var m2 = [];

function fill_matrix(_m, _j, _i) {
    var lj = _j;
    var li = _i;
    while (lj > 0) {
        readline().split(' ').forEach(function(c, i) {
            if (i < li) {
                if (!_m[_j - lj]) {
                     _m[_j - lj] = [];
                }
               _m[_j - lj][i] = parseInt(c);
            }
        });
        lj --;
    }
}

fill_matrix(m1, m, n);
fill_matrix(m2, m, n);

var isPossiableM1 = false;
var isPossiableM2 = false;

function shuffle_checker(_m1, _m2, can_shuffle) {
    var rows_check = true;
    var cols_check = true;
    _m1.forEach(function(row, j) {
        row.forEach(function(cell, i) {
            if (!rows_check || !cols_check) {
                return;
            }
            var nextCell = _m1[j][i + 1];
            var alternative = _m2[j][i + 1];
            if (nextCell) {
                if (cell >= nextCell && (!can_shuffle || (can_shuffle && alternative >= nextCell))) {
                    rows_check = false;
                }
            }
            var bottomCell = _m1[j + 1] && _m1[j + 1][i];
            var alternative2 = _m2[j + 1] && _m2[j + 1][i];
            if (bottomCell) {
                if (cell >= bottomCell && (!can_shuffle || (can_shuffle && alternative2 >= bottomCell))) {
                    cols_check = false;
                }
            }
        });
    });
    return rows_check && cols_check;
}

var p1 = false;
var p2 = false;

p1 = shuffle_checker(m1, m2, true);
p2 = shuffle_checker(m2, m1, false);

if (p1 && p2) {
    print('Possible');
} else {
    print('Impossible');
}

var m, n;

readline().split(' ').forEach(function(c, i) {
    if (i === 0) {
        m = parseInt(c);
        return;
    } else if  (i === 1) {
        n = parseInt(c);
    }
});

var m1 = [];
var m2 = [];
var shuffle_map = [];

function fill_matrix(_m, _j, _i) {
    var lj = _j;
    var li = _i;
    while (lj > 0) {
        readline().split(' ').forEach(function(c, i) {
            if (i < li) {
                if (!_m[_j - lj]) {
                     _m[_j - lj] = [];
                     shuffle_map[_j - lj] = [];
                }
               _m[_j - lj][i] = parseInt(c);
               shuffle_map[_j - lj][i] = false;
            }
        });
        lj --;
    }
}

fill_matrix(m1, m, n);
fill_matrix(m2, m, n);

function shuffle_checker(_m1, _m2) {
    var rows_check = true;
    var cols_check = true;
    _m1.forEach(function(row, j) {
        row.forEach(function(cell, i) {
            if (!rows_check || !cols_check) {
                return;
            }
            var nextCell = _m1[j][i + 1];
            var alternative = _m2[j][i];
            if (nextCell) {
                if (cell >= nextCell) {
                    rows_check = false;
                    if (alternative < nextCell && !shuffle_map[j][i]) {
                        _m2[j][i] = cell;
                        _m1[j][i] = alternative;
                        rows_check = true;
                    }
                }
            }
            var bottomCell = _m1[j + 1] && _m1[j + 1][i];
            if (bottomCell) {
                if (cell >= bottomCell) {
                    cols_check = false;
                    if (alternative < bottomCell && !shuffle_map[j][i]) {
                        _m2[j][i] = cell;
                        _m1[j][i] = alternative;
                        cols_check = true;
                    }
                }
            }
        });
    });
    return rows_check && cols_check;
}

var p1 = false;
var p2 = false;

p1 = shuffle_checker(m1, m2);
p2 = shuffle_checker(m2, m1);

if (p1 && p2) {
    print('Possible');
} else {
    print('Impossible');
}

var m, n;

readline().split(' ').forEach(function(c, i) {
    if (i === 0) {
        m = parseInt(c);
        return;
    } else if  (i === 1) {
        n = parseInt(c);
    }
});

var m1 = [];
var m2 = [];

function fill_matrix(_m, _j, _i) {
    var lj = _j;
    var li = _i;
    while (lj > 0) {
        readline().split(' ').forEach(function(c, i) {
            if (i < li) {
                if (!_m[_j - lj]) {
                     _m[_j - lj] = [];
                }
               _m[_j - lj][i] = parseInt(c);
            }
        });
        lj --;
    }
}

fill_matrix(m1, m, n);
fill_matrix(m2, m, n);

var isPossiableM1 = false;
var isPossiableM2 = false;

function shuffle_checker(_m1, _m2, can_shuffle) {
    var rows_check = true;
    var cols_check = true;
    _m1.forEach(function(row, j) {
        row.forEach(function(cell, i) {
            if (!rows_check || !cols_check) {
                return;
            }
            var nextCell = _m1[j][i + 1];
            var alternative = _m2[j][i + 1];
            if (nextCell) {
                if (cell >= nextCell && (!can_shuffle || (can_shuffle && alternative >= nextCell))) {
                    rows_check = false;
                }
            }
            var bottomCell = _m1[j + 1] && _m1[j + 1][i];
            var alternative2 = _m2[j + 1] && _m2[j + 1][i];
            if (bottomCell) {
                if (cell >= bottomCell && (!can_shuffle || (can_shuffle && alternative2 >= bottomCell))) {
                    cols_check = false;
                }
            }
        });
    });
    return rows_check && cols_check;
}

var p1 = false;
var p2 = false;

p1 = shuffle_checker(m1, m2, true);
p2 = shuffle_checker(m2, m1, true);

if (p1 && p2) {
    print('Possible');
} else {
    print('Impossible');
}

var m, n;

readline().split(' ').forEach(function(c, i) {
    if (i === 0) {
        m = parseInt(c);
        return;
    } else if  (i === 1) {
        n = parseInt(c);
    }
});

var m1 = [];
var m2 = [];

function fill_matrix(_m, _j, _i) {
    var lj = _j;
    var li = _i;
    while (lj > 0) {
        readline().split(' ').forEach(function(c, i) {
            if (i < li) {
                if (!_m[_j - lj]) {
                     _m[_j - lj] = [];
                }
               _m[_j - lj][i] = parseInt(c);
            }
        });
        lj --;
    }
}

fill_matrix(m1, m, n);
fill_matrix(m2, m, n);

var isPossiableM1 = false;
var isPossiableM2 = false;

function shuffle_checker(_m1, _m2, can_shuffle) {
    var rows_check = true;
    var cols_check = true;
    _m1.forEach(function(row, j) {
        row.forEach(function(cell, i) {
            if (!rows_check || !cols_check) {
                return;
            }
            var nextCell = _m1[j][i + 1];
            var alternative = _m2[j][i];
            if (nextCell) {
                if (cell >= nextCell && (!can_shuffle || (can_shuffle && alternative >= nextCell))) {
                    rows_check = false;
                    print(alternative);
                    print(i, j);
                }
            }
            var bottomCell = _m1[j + 1] && _m1[j + 1][i];
            if (bottomCell) {
                if (cell >= bottomCell && (!can_shuffle || (can_shuffle && alternative >= bottomCell))) {
                    cols_check = false;
                }
            }
        });
    });
    return rows_check && cols_check;
}

var p1 = false;
var p2 = false;

p1 = shuffle_checker(m1, m2, true);
p2 = shuffle_checker(m2, m1, true);

if (p1 && p2) {
    print('Possible');
} else {
    print('Impossible');
}

var m, n;

readline().split(' ').forEach(function(c, i) {
    if (i === 0) {
        m = parseInt(c);
        return;
    } else if  (i === 1) {
        n = parseInt(c);
    }
});

var m1 = [];
var m2 = [];
var shuffle_map = [];

function fill_matrix(_m, _j, _i) {
    var lj = _j;
    var li = _i;
    while (lj > 0) {
        readline().split(' ').forEach(function(c, i) {
            if (i < li) {
                if (!_m[_j - lj]) {
                     _m[_j - lj] = [];
                     shuffle_map[_j - lj] = [];
                }
               _m[_j - lj][i] = parseInt(c);
               shuffle_map[_j - lj][i] = false;
            }
        });
        lj --;
    }
}

fill_matrix(m1, m, n);
fill_matrix(m2, m, n);

function shuffle_checker(_m1, _m2) {
    var rows_check = true;
    var cols_check = true;
    _m1.forEach(function(row, j) {
        row.forEach(function(cell, i) {
            if (!rows_check || !cols_check) {
                return;
            }
            var nextCell = _m1[j][i + 1];
            var alternative = _m2[j][i];
            if (nextCell) {
                if (cell >= nextCell) {
                    rows_check = false;
                    if (alternative < nextCell && !shuffle_map[j][i]) {
                        shuffle_map[j][i] = true;
                        _m2[j][i] = cell;
                        _m1[j][i] = alternative;
                        rows_check = true;
                    }
                }
            }
            var bottomCell = _m1[j + 1] && _m1[j + 1][i];
            if (bottomCell) {
                if (cell >= bottomCell) {
                    cols_check = false;
                    if (alternative < bottomCell && !shuffle_map[j][i]) {
                        shuffle_map[j][i] = true;
                        _m2[j][i] = cell;
                        _m1[j][i] = alternative;
                        cols_check = true;
                    }
                }
            }
        });
    });
    return rows_check && cols_check;
}

var p1 = false;
var p2 = false;

p1 = shuffle_checker(m1, m2);
p2 = shuffle_checker(m2, m1);

if (p1 && p2) {
    print('Possible');
} else {
    print('Impossible');
}

var m, n;

readline().split(' ').forEach(function(c, i) {
    if (i === 0) {
        m = parseInt(c);
        return;
    } else if  (i === 1) {
        n = parseInt(c);
    }
});

var m1 = [];
var m2 = [];

function fill_matrix(_m, _j, _i) {
    var lj = _j;
    var li = _i;
    while (lj > 0) {
        readline().split(' ').forEach(function(c, i) {
            if (i < li) {
                if (!_m[_j - lj]) {
                     _m[_j - lj] = [];
                }
               _m[_j - lj][i] = parseInt(c);
            }
        });
        lj --;
    }
}

fill_matrix(m1, m, n);
fill_matrix(m2, m, n);

var isPossiableM1 = false;
var isPossiableM2 = false;

function shuffle_checker(_m1, _m2, can_shuffle) {
    var rows_check = true;
    var cols_check = true;
    _m1.forEach(function(row, j) {
        row.forEach(function(cell, i) {
            if (!rows_check || !cols_check) {
                return;
            }
            var nextCell = _m1[j][i + 1];
            var alternative = _m2[j][i];
            if (nextCell) {
                if (cell >= nextCell && (!can_shuffle || (can_shuffle && alternative >= nextCell))) {
                    rows_check = false;
                }
            }
            var bottomCell = _m1[j + 1] && _m1[j + 1][i];
            if (bottomCell) {
                if (cell >= bottomCell && (!can_shuffle || (can_shuffle && alternative >= bottomCell))) {
                    cols_check = false;
                }
            }
        });
    });
    return rows_check && cols_check;
}

var p1 = false;
var p2 = false;

p1 = shuffle_checker(m1, m2, true);
p2 = shuffle_checker(m2, m1, true);

if (p1 && p2) {
    print('Possible');
} else {
    print('Impossible');
}

let i = '';
process.stdin.on('data', (c) => {
  i += c;
});
process.stdin.on('end', () => {
  const { EOL } = require('os');
  const lines = i.split(EOL);
  const n = parseInt(lines[0].split(' ')[0], 10);
  let index = 1;
  const m1 = [];
  for (let i = 0; i < n; i++) {
    let r = lines[index].split(' ');
    r = r.map(data => parseInt(data));
    m1.push([...r]);
    index++;
  }
  const m2 = [];
  for (let i = 0; i < n; i++) {
    let r = lines[index].split(' ');
    r = r.map(data => parseInt(data));
    m2.push([...r]);
    index++;
  }
  isPossible(m1, m2);
});

function isPossible(m1, m2) {
  for (let i = 0; i < m1.length; i++) {
    for (let j = 0; j < m1[i].length; j++) {
      if (!isIncreasing(m1, i, j, m1[i][j]) || !isIncreasing(m2, i, j, m2[i][j])) {
        if (canSwap(m1, m2, i, j)) {
          swap(m1, m2, i, j);
        } else {
          console.log('Impossible');
          return;
        }
      }
    }
  }
  console.log('Possible');
}

function canSwap(m1, m2, i, j) {
  return isIncreasing(m1, i, j, m2[i][j]) && isIncreasing(m2, i, j, m1[i][j]);
}

function swap(m1, m2, i, j) {
  const temp = m1[i][j];
  m1[i][j] = m2[i][j];
  m2[i][j] = temp;
}

function isIncreasing(m, i, j, curr) {
  // check above
  if (m[i - 1]) {
    if (m[i - 1][j] >= curr) return false;
  }

  // check below
  if (m[i + 1]) {
    if (m[i + 1][j] <= curr) return false;
  }

  // check left
  if (m[i][j - 1]) {
    if (m[i][j - 1] >= curr) return false;
  }

  // check right
  if (m[i][j + 1]) {
    if (m[i][j + 1] <= curr) return false;
  }
  return true;
}


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

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n')
  const q = parseInt(arr.shift())

  let lineCount = 0
  for(let i = 0; i < q; i++) {
    const n = parseInt(arr[lineCount ++])
    const a1 = arr[lineCount ++]
    const a2 = arr[lineCount ++ ]

    let i = 0, j = -1, currentRow = 1
    let shift = false
    while(j < n && i < n){
      // console.log(i, j, currentRow)
      if(currentRow == 1) {
        if(a1[i] <= 2 && !shift) i++
        else if(a1[i] <= 2 && shift) break
        else if(a1[i] >= 3 && shift) {
          shift = false
          i ++
        }
        else{
          currentRow = 2
          shift = true
          j = i
        }
      }
      else {
        // if(j == 6) console.log(a2[j])
        if(a2[j] <= 2 && !shift) j++
        else if(a2[j] <= 2 && shift) break
        else if(a2[j] >= 3 && shift) {
          // console.log('kl')
          shift = false
          j ++
        }
        else{
          currentRow = 1
          shift = true
          i = j
        }
      }
    }
    if(j == n) console.log('YES')
    else console.log('NO')

    // console.log()
    // console.log()
    // console.log()
  }
})

'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++];
}

function main() {
    const q = readline();
    for(let i = 0;i<q;i++){
        const length = readline();
        const matrix = [];
        const firstRow = readline().split('').map((value,index,array)=>{return parseInt(value)});
        const secondRow = readline().split('').map((value,index,array)=>{return parseInt(value)});
        matrix[0] = firstRow;
        matrix[1] = secondRow;
        calcQuery(length,matrix);
    }
}

function calcQuery(length,matrix){
    let y = 0;
    for(let x = 0; x < length;x++){
        if(matrix[y][x] > 2 && matrix[(y+1)%2][x] < 3){
            console.log("NO");
            return;
        }
        if(matrix[y][x] > 2 && matrix[(y+1)%2][x] > 2){
            y = (y+1) % 2;
        }
    }
    if(y != 1){
        console.log("NO");
        return;
    }
    console.log("YES");
}

'use strict'

const tube = (n, l) => {
    let from = 'left';
    let x = 0;
    let y = 0;
    while (x < n) {
        if (l[y][x]) { if (from === 'left') x++; else return 'NO'; }
        else {
            if (from === 'left') {
                if (y) { y = 0; from = 'bottom';}
                else { y = 1; from = 'top'; }
            }
            else { x++; from = 'left'; }
        }
    }

    return y ? 'YES' : 'NO';
}
const q = parseInt(readline());

for (let i = 0; i < q; i++) {
    write(tube(parseInt(readline()), [ readline().split('').map(i => parseInt(i) < 3), readline().split('').map(i => parseInt(i) < 3) ]) + '\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.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

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

function main() {
    const q = readline();
    for(let i = 0;i<q;i++){
        const length = readline();
        const matrix = [];
        const firstRow = readline().split('').map((value,index,array)=>{return parseInt(value)});
        const secondRow = readline().split('').map((value,index,array)=>{return parseInt(value)});
        matrix[0] = firstRow;
        matrix[1] = secondRow;
        calcQuery(length,matrix);
    }
}

function calcQuery(length,matrix){
    let counter = 0;
    for(let i = 0; i < length;i++){
        if(matrix[0][i] < 3 && matrix[1][i] > 2){
            console.log("NO");
            return;
        }
        if(matrix[0][i] > 2 && matrix[1][i] < 3){
            console.log("NO");
            return;
        }
        if(matrix[0][i] < 3 && matrix[1][i] < 3){
            counter ++;
        }
    }
    if((length - counter) % 2 == 0){
        console.log("NO");
        return;
    }
    console.log("YES");
}


"use strict";
function main(input) {
  const inputs = input.split("\n").filter(x => x !== "");

  const N = Number(inputs[0]);
  const M = [];
  for (let i=0;i<N;i++){
    M[i] = inputs[i+1].split("");
  }

  let count = 0;
  for (let i = 1; i<N-1;i++) {
    for (let j = 1; j<N-1;j++) {
      if (M[i][j] === "X" && M[i-1][j-1] === "X" && M[i-1][j+1] === "X" && M[i+1][j-1] === "X" && M[i+1][j+1] === "X") {
        count++;
      }
    }
  }

  console.log(count);
}

let input = ''
process.stdin.on('data', c => input += c)
process.stdin.on('end', () => {
  main(input)
})

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
	};
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var list = new Array(N);
  for(var i = 0; i < N; i++){
    list[i] = next();
  }
  var output = 0;
  if(N <= 2){
    myout(output);
    return;
  }
  for(var i = 0; i < N - 2; i++){
    for(var j = 0; j < N - 2; j++){
      if(list[i][j] == "X"){
        if(list[i][j + 2] == "X" &&
          list[i + 2][j] == "X" &&
          list[i + 1][j + 1] == "X" &&
          list[i + 2][j + 2] == "X"){
          output++;
        }
      }
    }
  }
  myout(output);
}

"use strict";
// NYAN NYAN
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄░░░░░░░░░
// ░░░░░░░░▄▀░░░░░░░░░░░░▄░░░░░░░▀▄░░░░░░░
// ░░░░░░░░█░░▄░░░░▄░░░░░░░░░░░░░░█░░░░░░░
// ░░░░░░░░█░░░░░░░░░░░░▄█▄▄░░▄░░░█░▄▄▄░░░
// ░▄▄▄▄▄░░█░░░░░░▀░░░░▀█░░▀▄░░░░░█▀▀░██░░
// ░██▄▀██▄█░░░▄░░░░░░░██░░░░▀▀▀▀▀░░░░██░░
// ░░▀██▄▀██░░░░░░░░▀░██▀░░░░░░░░░░░░░▀██░
// ░░░░▀████░▀░░░░▄░░░██░░░▄█░░░░▄░▄█░░██░
// ░░░░░░░▀█░░░░▄░░░░░██░░░░▄░░░▄░░▄░░░██░
// ░░░░░░░▄█▄░░░░░░░░░░░▀▄░░▀▀▀▀▀▀▀▀░░▄▀░░
// ░░░░░░█▀▀█████████▀▀▀▀████████████▀░░░░
// ░░░░░░████▀░░███▀░░░░░░▀███░░▀██▀░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// 백준의 노드 버전이 너무 낮아 babel 사용.
// 풀이는 solve() 함수에 있음.
const CODEFORCES_NODE = "cf";
const CODEFORCES_V8 = "cf-v8";
const BEAKJOON = "bj";
const TEST = "test";
const PROGRAMMERS = "ps";
var SITE = CODEFORCES_NODE;
// var SITE = CODEFORCES_NODE;
// var SITE = PROGRAMMERS;
var DEBUG = false;
if (SITE == BEAKJOON) {
    if (!String.prototype.startsWith) {
        String.prototype.startsWith = function (search, pos) {
            return this.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
        };
    }
    if (!String.prototype.endsWith) {
        String.prototype.endsWith = function (search, this_len) {
            if (this_len === undefined || this_len > this.length) {
                this_len = this.length;
            }
            return this.substring(this_len - search.length, this_len) === search;
        };
    }
    if (!String.prototype.repeat) {
        String.prototype.repeat = function (count) {
            'use strict';
            if (this == null) {
                throw new TypeError('can\'t convert ' + this + ' to object');
            }
            var str = '' + this;
            count = +count;
            if (count != count) {
                count = 0;
            }
            if (count < 0) {
                throw new RangeError('repeat count must be non-negative');
            }
            if (count == Infinity) {
                throw new RangeError('repeat count must be less than infinity');
            }
            count = Math.floor(count);
            if (str.length == 0 || count == 0) {
                return '';
            }
            // Ensuring count is a 31-bit integer allows us to heavily optimize the
            // main part. But anyway, most current (August 2014) browsers can't handle
            // strings 1 << 28 chars or longer, so:
            if (str.length * count >= 1 << 28) {
                throw new RangeError('repeat count must not overflow maximum string size');
            }
            var maxCount = str.length * count;
            count = Math.floor(Math.log(count) / Math.log(2));
            while (count) {
                str += str;
                count--;
            }
            str += str.substring(0, maxCount - str.length);
            return str;
        };
    }
}
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ HELPER ALGORITHMS/POLYFILLS ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
function getCombinations2(n) {
    let ret = [];
    for (let start = 0; start < n; start++) {
        for (let k = start + 1; k < n; k++) {
            let s = new Set();
            s.add(start);
            s.add(k);
            ret.push(s);
        }
    }
    return ret;
}

function getSubbits(n) {
    let ret = [];
    for (var subset = n; subset; subset = (subset - 1) & n) {
        ret.push(subset);
    }
    return ret;
}
String.prototype.replaceAt = function (index, replacement) {
    return this.substr(0, index) + replacement + this.substr(index + replacement.length);
};
Function.prototype.repeat = function (times, callback = undefined) {
    for (let i = 0; i < times; i++) {
        this();
    }
    return callback ? callback() : null;
};
Array.prototype.getMaxConsecutiveSum = function (defaultValue = -Infinity) {
    const N = this.length;
    let maxsum = defaultValue;
    let cursum = defaultValue;
    let cur;
    for (var ii = 0; ii < N; ii++) {
        cur = this[ii];
        if (cursum + cur > 0) {
            if (cur > cursum + cur) {
                cursum = cur;
            } else
                cursum += cur;
        } else {
            cursum = cur;
            if (maxsum < cursum) {
                maxsum = cursum;
            }
        }
        if (maxsum < cursum) {
            maxsum = cursum;
        }
    }
    this.maxConsecutiveSum = maxsum;
    return maxsum;
};
try {
    require('manakin').global;
    // require ("babel-polyfill");
} catch (error) {}
try {
    process.argv.forEach(function (val, index, array) {
        if (val.startsWith("site")) {
            switch (val.split("=")[1]) {
                case "test":
                    // console.log('change site to test')
                    SITE = TEST;
                    break;
                case "cf-node":
                    // console.log('change site to cf')
                    SITE = CODEFORCES_NODE;
                    break;
                case "cf":
                    // console.log('change site to cf')
                    SITE = CODEFORCES_NODE;
                    break;
                case "cf-v8":
                    // console.log('change site to cf')
                    SITE = CODEFORCES_V8;
                    break;
                case "bj":
                    // console.log('change site to bj')
                    SITE = BEAKJOON;
                    break;
            }
        }
        if (val.startsWith("debug")) {
            switch (val.split("=")[1]) {
                case "true":
                    DEBUG = true;
                    break;
                case "false":
                    DEBUG = false;
                    break;
            }
        }
    });
} catch (error) {}
let inputFilePath = '';
switch (SITE) {
    case TEST:
        const config = require('config');
        var fs = require("fs");
        var path = require('path');
        inputFilePath = config.get('INPUTFILEPATH') || path.resolve(__dirname, "input.txt");
        break;
    default:
        inputFilePath = './input.txt';
        break;
}
const INPUTFILEPATH = inputFilePath;
// if (!String.prototype.endsWith) {
// 	String.prototype.endsWith = function(search, this_len) {
// 		if (this_len === undefined || this_len > this.length) {
// 			this_len = this.length;
// 		}
// 		return this.substring(this_len - search.length, this_len) === search;
// 	};
// }
// if (!Array.prototype.includes) {
//   Array.prototype.includes = function (target) {
//     return this.indexOf(target) !== -1
//   }
// }
if (!Array.prototype.sortNumber) {
    /**
     * @memberof Array
     * @summary sorts array by number
     */
    Array.prototype.sortNumber = function (order = 'asc') {
        return this.sort((a, b) => ((order == 'asc') ? 1 : -1) * (+a - +b));
    };
}
const newLine = '\n';
var ans;
var inputText = "";
var lineCount = 0;
var lines;
var input;
/**
 * @type {(trim?=true)=>string}
 */
var readline;
var getlines;
var lineOpen = false;
var readingLine = '';
var clockStart;
var clock;
/**
 * @type {typeof import('glob')}
 */
var glob;
var customFilesPattern = 'inputs/**/*.in';
var customFiles = [];
var print;
print = console.log;
var it;
var step;

function EnableLogging() {
    it = console.info;
    step = console.success;
}

function DisableLogging() {
    it = function it(params) {
        return 0;
    };
    step = it;
}

function RunCustomTests() {
    // glob = require('glob');
    // it(process.cwd());
    // it(process.cwd() + customFilesPattern);
    // glob(customFilesPattern, (er,files)=>{
    //   console.log('files count: ' + files.length);
    //   files.forEach(file=>{
    //     console.log(`custom test case files : ${file}`);
    //     customFiles.push(file);
    //   })
    // });
    // var path2 = process.cwd().replace(/\\/g, "/");
    // path = require('path');
    // glob("*.js", (er,files)=>{
    //   console.log('files count: ' + files.length);
    //   files.forEach(file=>{
    //     console.log(`custom test case files : ${file}`);
    //   })
    // });
    // customFiles.forEach(file=>{
    //   const filePath = process.cwd() + file;
    //   console.info(filePath);
    // })
}
if (DEBUG) {
    EnableLogging();
    clock = function (start) {
        if (!start)
            return process.hrtime();
        var end = process.hrtime(start);
        return Math.round((end[0] * 1000) + (end[1] / 1000000));
    };
} else {
    DisableLogging();
}
// prepares test data. to replace line input, assign arrays to lines variable.
function prepareTestData() {
    // it(lines);
    // lines = ['custom line 1', 'custom line 2'];
}
// executes exactly once for both test and run. execution time will be included to elapsed time.
const prepareSolve = () => {};

function power(x, y) {
    let ret = 1;
    while (y > 0) {
        if (y % 2) {
            ret *= x;
            ret %= P;
        }
        x *= x;
        x %= P;
        y /= 2;
    }
    return ret;
}

function createArray(lengths) {
    var arr = new Array(lengths || 0),
        i = lengths;
    if (arguments.length > 1) {
        var args = Array.prototype.slice.call(arguments, 1);
        while (i--)
            arr[lengths - 1 - i] = createArray.apply(this, args);
    }
    return arr;
}

function numericSortList(list) {
    list.sort((a, b) => a - b);
}

function getRectangleIntersection(r1, r2) {
    if (r1.x > r2.x + r2.w)
        return null;
    if (r1.x + r1.w < r2.x)
        return null;
    if (r1.y > r2.y + r2.h)
        return null;
    if (r1.y + r1.h < r2.y)
        return null;
    var rect = {};
    rect.x = Math.max(r1.x, r2.x);
    rect.y = Math.max(r1.y, r2.y);
    rect.w = Math.min(r1.x + r1.w, r2.x + r2.w) - rect.x;
    rect.h = Math.min(r1.y + r1.h, r2.y + r2.h) - rect.y;
    return rect;
}

function getRandomNumber(to, from) {
    if (from == undefined) {
        return Math.floor(Math.random() * to + 1);
    }
    return Math.floor(Math.random() * (to - from) + from);
}
/**
 * a queue that will be stop working someday.
 */
class TerminallyIllQueue {
    constructor() {
        this.data = {};
        this.head = 0;
        this.tail = 1;
    }
    length() {
        return this.tail - this.head - 1;
    }
    enqueue(v) {
        this.data[this.tail - 1] = v;
        this.tail++;
    }
    dequeue() {
        const v = this.data[this.head];
        this.head++;
        return v;
    }
}
/**
 * @template T
 * @type {TwoDimensionalMap<T>}
 */
class TwoDimensionalMap {
    constructor() {
        this.data = {};
    }
    /**
     * @memberof TwoDimensionalMap<T>
     * @public
     * @param {number} x
     * @param {number} y
     * @returns {T}
     */
    getPosition(x, y) {
        return this.data[`${x}.${y}`];
    }
    /**
     * @memberof TwoDimensionalMap<T>
     * @public
     * @param {number} x
     * @param {number} y
     * @param {T} value
     */
    setPosition(x, y, value) {
        this.data[`${x}.${y}`] = value;
    }
}
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ MAIN SOLVE FUNCTION ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
function solve() {
    const n = ri();
    var maps = new TwoDimensionalMap();
    for (var j = 0; j < n; j++) {
        const li = rs();
        // it(li);
        for (var i = 0; i < n; i++) {
            maps.setPosition(i, j, li[i]);
        }
    }

    var ans = 0;
    for (var y = 0; y < n; y++) {
        for (var x = 0; x < n; x++) {
            it(maps.getPosition(x,y));
            if (maps.getPosition(x, y) != 'X') continue;
            if (maps.getPosition(x - 1, y - 1) == 'X' &&
                maps.getPosition(x - 1, y + 1) == 'X' &&
                maps.getPosition(x + 1, y - 1) == 'X' &&
                maps.getPosition(x + 1, y + 1) == 'X') {
                ans++;
            }
        }
    }
    print(ans);
}
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
function resetRead() {
    lineCount = 0;
}

function checkMemoryUsage() {
    it(process.memoryUsage());
}

function readOne(separator = ' ') {
    if (lineOpen && readingLine != null) {
        // if(lineOpen){
        // it(readingLine);
        let splitPos = readingLine.search(separator);
        let ret = readingLine.slice(0, splitPos);
        if (splitPos == -1) {
            // it('close');
            ret = readingLine;
            readingLine = '';
            lineOpen = false;
        }
        readingLine = readingLine.substr(splitPos + 1);
        // it(ret, readingLine, splitPos);
        if (ret == '' || ret == separator) {
            return readOne(separator);
        } else {
            return ret;
        }
    } else {
        readingLine = readline();
        lineOpen = true;
        if (readingLine == null)
            return '';
        return readOne(separator);
    }
}

function ri() {
    return +readOne();
}

function ria() {
    return readInts();
}
/**
 * @return {string}
 */
function rs() {
    return readOne();
}
/**
 * @return {string[]}
 */
function rsa() {
    return readline().split(' ');
}
/**
 * @returns {number[]}
 */
function readInts() {
    try {
        lineOpen = false;
        return readline()
            .split(" ")
            .map(x => parseInt(x));
    } catch (error) {
        console.error(error);
        return null;
    }
}
let inputListener;
let readlines;
switch (SITE) {
    case TEST:
        var fs = require("fs");
        var path = require('path');
        // input = fs.createReadStream(path.resolve(__dirname, "input.txt"), {
        //   encoding: "utf8"
        // });
        input = fs.createReadStream(INPUTFILEPATH, {
            encoding: "utf8"
        });
        inputListener = (line) => {
            console.log(line);
            if (line.startsWith('end')) {
                console.log('end');
                closing();
            }
            if (!line) {
                closing();
            }
            lineCount++;
            inputText += line + "\r\n";
        };
        readlines = () => {
            const readline = require("readline");
            const rl = readline.createInterface({
                input,
                output: process.stdout,
                terminal: false
            });
            rl.on("line", inputListener);
            rl.on('close', closing);
        };
        getlines = function* (inputText) {
            var lines = inputText.split(/\r?\n/);
            for (let line of lines) {
                yield line + newLine;
            }
        };
        readline = function (trim = true) {
            const lineval = lines.next().value;
            return trim ? lineval.trim() : lineval;
        };
        readlines();
        break;
    case CODEFORCES_NODE:
        input = process.stdin;
        inputListener = (line) => {
            if (!line) {
                closing();
            }
            lineCount++;
            inputText += line + "\r\n";
        };
        readlines = () => {
            const readline = require("readline");
            const rl = readline.createInterface({
                input,
                output: process.stdout,
                terminal: false
            });
            rl.on("line", inputListener);
            rl.on('close', closing);
        };
        getlines = function* (inputText) {
            var lines = inputText.split(/\r?\n/);
            for (let line of lines) {
                yield line + newLine;
            }
        };
        readline = function (trim = true) {
            const lineval = lines.next().value;
            return trim ? lineval.trim() : lineval;
        };
        readlines();
        break;
    case BEAKJOON:
        var fs = require('fs');
        if (DEBUG) {
            // input = fs.readFileSync('./input.txt').toString();
            inputText = fs.readFileSync(INPUTFILEPATH).toString();
        } else {
            inputText = fs.readFileSync('/dev/stdin').toString();
        }
        readline = function (trim = true) {
            lineCount++;
            let line = lines[lineCount - 1];
            if (line)
                return trim ? lines[lineCount - 1].trim() : lines[lineCount - 1];
            else
                return null;
        };
        getlines = function (inputText) {
            lineCount = 0;
            return inputText.split(/\r?\n/);
        };
        // lines = getlines(input);
        closing();
        break;
    case PROGRAMMERS:
        //자체 함수를 실행할 것이므로 아무것도 하지 않는다.
    default:
        break;
}

function closing() {
    if (DEBUG) {
        DisableLogging();
        const prepareClock = clock();
        lines = getlines(inputText);
        prepareSolve();
        const prepareClockElapsedTime = clock(prepareClock);
        EnableLogging();
        prepareTestData();
        solve();
        console.warn('done. running custom tests');
        RunCustomTests();
        resetRead();
        console.warn('performance check');
        DisableLogging();
        clockStart = clock();
        // lines = getlines(inputText);
        solve();
        console.warn(`${clock(clockStart) + prepareClockElapsedTime} ms`);
        EnableLogging();
        process.exit();
    } else {
        lines = getlines(inputText);
        prepareSolve();
        solve();
        process.exit();
    }
}

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
const matrix = [];

rl.on('line', (str) => {
  if (c === 0) {
    c++;
    return;
  }

  const col = [...str];
  matrix.push(col);

  c++;
});

rl.on('close', () => {
  let ans = 0;

  for (let i = 1; i < matrix.length - 1; i++) {
    for (let j = 1; j < matrix.length - 1; j++) {
      if (matrix[i][j] === 'X' && matrix[i - 1][j - 1] === 'X' && matrix[i - 1][j + 1] === 'X' && matrix[i + 1][j - 1] === 'X' && matrix[i + 1][j + 1] === 'X') {
        ans++;
      }
    }
  }

  console.log(ans);
});

(function() {

    var read = {
        number: function() {
            return +readline();
        },
        arr: function() {
            return readline(' ').split('');
        },
        arrNumber: function() {
            return +readline(' ')
                .split(' ')
                .map(item => +item);
        }
    }

    var n = read.number();
    var arr = [];
    for(var i = 0; i < n; i++) {
        arr[i] = [];
        arr[i] = read.arr();
    }

    var count = 0;

    for(var i = 1; i < n - 1; i++) {
        for(var j = 1; j < n - 1; j++) {
            if(arr[i][j] == 'X' && arr[i - 1][j - 1] == 'X' && arr[i + 1][j + 1] == 'X' && arr[i - 1][j + 1] == 'X' && arr[i + 1][j - 1] == 'X') {
                count++;
            }
        }
    }

    print(count);
}());


let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    let lines = i.split(EOL)
    let color = 'blue';
    let status = 'unlock'
    lines = lines.slice(1, lines.length - 1);
        lines.forEach(item => {
        switch (item) {
            case 'unlock':
                status = 'unlock';
                break;
            case 'lock':
                status = 'lock';
                break;
            default:
                if (status === 'lock') {
                    break;
                } else if (status === 'unlock') {
                    color = item;
                }
        }
    });
    console.log(color);
});

const fs = require('fs');
const readline = require('readline');
const path = require('path')

class CommandsCounter {
    count = undefined

    isInited() {
        return typeof this.count !== 'undefined';
    }

    setInitialCount(count) {
        if (this.isInited()) {
            throw new Error('Commands counter is already inited');
        }

        this.count = count;
    }

    isCommandsLeft() {
        return this.count > 0;
    }

    decreaseCounter() {
        this.count--;
    }
}

class ZingerLight {
    color = 'blue';
    commandsCounter = 0
    isLocked = false;

    commandsCounter

    constructor(commandsCounter) {
        this.commandsCounter = commandsCounter;
    }

    get currentColor() {
        return this.color;
    }

    exec(command) {
        switch(command) {
            case 'lock':
                return this.lock();
            case 'unlock':
                return this.unlock();
            case 'red':
            case 'orange':
            case 'yellow':
            case 'green':
            case 'blue':
            case 'indigo':
            case 'violet':
                return this.setColor(command);
            default:
                console.log(`Command "${command}" is not recognized`);
        }
    }

    lock() {
        this.isLocked = true;
    }

    unlock() {
        this.isLocked = false;
    }

    setColor(color) {
        if (!this.isLocked) {
            this.color = color;
        }
    }
}

// MAIN

function main() {
    const zingerLight = new ZingerLight();
    const commandsCounter = new CommandsCounter();
    // const readStream = fs.createReadStream(path.resolve(__dirname, './input_1'));
    const readStream = process.stdin;

    const lineCallback = (line) => processLine(zingerLight, commandsCounter, line);
    const closeCallback = () => sendAnswer(zingerLight.currentColor);

    initInputRead(readStream, lineCallback, closeCallback);
}

main();

// ---

function initInputRead(inputInterface, lineCb, closeCb) {
    const readInterface = readline.createInterface({
        input: inputInterface,
    });

    readInterface.on('line', line => lineCb(line));
    readInterface.on('close', () => closeCb());
}

function processLine(zingerLight, commandsCounter, line) {
    // first line: init counter
    if (!commandsCounter.isInited()) {
        commandsCounter.setInitialCount(Number(line));
        return;
    }

    // exec commands while counter of commands is more than inited in first line
    if (commandsCounter.isCommandsLeft()) {
        zingerLight.exec(line);
        commandsCounter.decreaseCounter();
        return;
    }
}

function sendAnswer(answer) {
    process.stdout.write(answer);
    process.stdout.write('\n');
}

const fs = require('fs');
const print = console.log;

let input = fs.readFileSync(0).toString();
input = input.split(/\r?\n/g);

const COLORS = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'];

let n = +input[0];
let state = 'unlock';
let color = 'blue';

for (let i = 1; i <= n; i++) {
  let cmd = input[i];

  switch (cmd) {
    case 'lock':
    case 'unlock':
      state = cmd;
      break;
    default:
      if (state == 'unlock') {
        color = cmd;
      }
  }
}

print(color);

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

var count_of_commands
var commands = []
function start() {
    rl.question("", function(answer) {
      count_of_commands = parseInt(answer)
      get_com()
    });
}

function get_command() {
    rl.question("", function(answer) {
        commands.push(answer)
        count_of_commands--
        get_com()
    });

}

function get_com() {
    if (count_of_commands > 0) {
        get_command()
    } else {
        get_color()
    }
}

function get_color() {
    var locked = false
    var color = "blue"
    commands.forEach((com, cim_index) => {
        if (com == "lock") {
            locked = true
        } else if (com == "unlock") {
            locked = false
        } else {
            if (locked == false) {
                color = com
            }
        }
    })
    console.log(color)
}

start();

const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

const defaultColor = 'blue';
const colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'];

let locked = false;
let currentColor = 'blue';
let argumentsFlow = [];

rl.on('line', function(line){
    argumentsFlow.push(line);
});

rl.on('close', function() {
    for (let i = 0; i < argumentsFlow.length; i++) {
        if (colors.includes(argumentsFlow[i]) && !locked) {
            currentColor = argumentsFlow[i];
        }
        else if (argumentsFlow[i] === 'lock') {
            locked = true;
        }
        else if (argumentsFlow[i] === 'unlock') {
            locked = false;
        }

    }
    process.stdout.write(currentColor);
})

const colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet', ];

function program(lines) {

  const count = Number(lines[0]);

  let color = "blue";
  let locked = false;

  for (let i = 1; i <= count; i++) {
    const command = lines[i].trim();
    if (command === "lock" && !locked) {
      locked = true;
    }
    if (command === "unlock" && locked) {
      locked = false;
    }
    if (colors.includes(command) && !locked) {
      color = command;
    }
  }

  return color;
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const { EOL } = require('os')
  const lines = i.split(EOL)
  console.log(program(lines));
})

const n = readline();
var nowStatus = "blue";
var flag = false;
for (var i = 0; i < n; i++) {
    var command = readline();

    switch (command) {
        case 'lock':
            flag = true;
            break;
        case 'unlock':
            flag = false;
            break;
        default:
            if (!flag) {
                nowStatus = command;
            }
    }
}

print(nowStatus);

const readline = require('readline');
const { stdin: input, stdout: output } = require('process');

const rl = readline.createInterface({ input, output });

const COLORS = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'];

let isLocked = false;
let currentColor = "blue";

rl.on('line', function foo(input) {
  if (input === "lock") {
    isLocked = true;
    return;
  }
  if (input === "unlock") {
    isLocked = false;
    return;
  }
  if (isLocked) {
    return;
  }
  if (COLORS.includes(input)) {
    currentColor = input;
  }
});

rl.on('close', function boo(input) {
  console.log(currentColor);
});

const readline = require('readline');
const { stdin: input, stdout: output } = require('process');

const rl = readline.createInterface({ input, output });

let isLocked = false;
let currentColor = "blue";

const COLORS = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'];

rl.on('line', function foo(input) {
  if (input === "lock") {
    isLocked = true;
    return;
  }
  if (input === "unlock") {
    isLocked = false;
    return;
  }
  if (isLocked) {
    return;
  }
  if (COLORS.includes(input)) {
    currentColor = input;
  }
});

rl.on('close', function boo(input) {
  console.log(currentColor);
});

var readline = require('readline');
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    terminal: false
});

let currentState = 'unlock'
let currentColor = 'blue'
let i = 0

rl
    .on('line', value => {
        if (i === 0) {
            i++
            return
        }
        if (value === 'lock' || value === 'unlock') {
            currentState = value
            return;
        }
        if (currentState !== 'lock') {
            currentColor = value
        }
    })
    .on('close', () => {
        process.stdout.write(currentColor)
    })

var readline = require('readline');
var fs = require('fs');
var rl = readline.createInterface({
    // input: fs.createReadStream('./A.txt'),
    input: process.stdin,
    output: process.stdout,
    terminal: false
});

// function A (content) {
//     let currentState = 'unlock'
//     let currentColor = 'blue'
//     for (let i = 0; i < content.length; i++) {
//         let value = content[i]
//         if (i === 0) {
//             continue
//         }
//         if (content[i] === 'lock' || content[i] === 'unlock') {
//             currentState = value
//             continue
//         }
//         if (currentState !== 'lock') {
//             currentColor = value
//         }
//     }
//     return currentColor
// }

let currentState = 'unlock'
let currentColor = 'blue'
let i = 0

rl
    .on('line', value => {
        if (i === 0) {
            i++
            return
        }
        if (value === 'lock' || value === 'unlock') {
            currentState = value
            return;
        }
        if (currentState !== 'lock') {
            currentColor = value
        }
        i++
    })
    .on('close', () => {
        process.stdout.write(currentColor)
    })

// module.exports = A

const readline = require('readline');
const fs = require('fs');

const readInterface = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    console: false
});

let count = 0;
let quantity = 0;
let flag = false;
let output = 'blue';

readInterface.on('line', function(line) {
    if (count === 0) {
        quantity = line;
    } else {
        switch (line) {
            case 'lock':
                flag = true
                break;
            case 'unlock':
                flag = false
                break;
            case 'red':
            case 'orange':
            case 'yellow':
            case 'green':
            case 'blue':
            case 'indigo':
            case 'violet':
                output = !flag ? line : output;
                break;
        }
    }

    if (count == quantity) {
        console.log(output);
    }

    count++;

});

let inputString = '';

process.stdin.on('data', chunk => inputString += chunk);
process.stdin.on('end', () => {
    const lines = inputString
        .split('\n')
        .map(line => line.trim())
        .filter(line => line.length > 0);

    const count = +lines[0];
    const messages = lines.slice(1, count + 1);

    const LOCK = 'lock';
    const UNLOCK = 'unlock';
    const ALLOW_COLORS = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'];

    let isLock = false;
    let currentColor = 'blue';

    messages.forEach((message) => {
        if (message === UNLOCK) {
            isLock = false;
        }

        if (message === LOCK) {
            isLock = true;
        }

        if (ALLOW_COLORS.includes(message) && !isLock) {
            currentColor = message;
        }
    });

    console.log(currentColor);
});

let i = '';
process.stdin.on('data', (c) => (i += c));
process.stdin.on('end', () => {
  const { EOL } = require('os');
  const lines = i.split(EOL);
  const N = parseInt(lines[0]);
  let res = 'blue';
  let isUnlock = true;

  const color = {
    blue: 'blue',
    red: 'red',
    orange: 'orange',
    yellow: 'yellow',
    green: 'green',
    indigo: 'indigo',
    violet: 'violet',
  };

  for (let i = 1; i < lines.length; i++) {
    if (lines[i] === 'lock') {
      isUnlock = false;
    } else if (lines[i] === 'unlock') {
      isUnlock = true;
    }
    if (isUnlock) {
      if (color[lines[i]] != undefined) {
        res = lines[i];
      }
    }
  }

  console.log(res);
});

const nextString = (function() {
  const listeners = [], strings = [], ps = process.stdin
  let last = ''
  ps.setEncoding('utf8')
  ps.on('readable', () => {
    let chunk
    while ((chunk = ps.read()) !== null) {
      chunk = (last + chunk).split(/\r\n|\r|\n/)
      last = chunk[chunk.length - 1]
      for (let i = 0; i < chunk.length - 1; ++i) {
        if (chunk[i].length > 0) {
          if (listeners.length > 0) {
            listeners.shift(1)(chunk[i])
          }
          else {
            strings.push(chunk[i])
          }
        }
      }
    }
  })
  const fn = resolve => {
    if (strings.length > 0) {
      resolve(strings.shift(1))
    }
    else {
      listeners.push(resolve)
    }
  }
  return () => new Promise(fn)
})()

async function main() {
  let n = +await nextString()
  let ans = 'blue'
  let lock = 'lock'
  let unlock = 'unlock'
  let locked = false
  for (let i = 0; i < n; ++i) {
    let next = await nextString()
    if (next === lock) {
      locked = true
    }
    else if (next === unlock) {
      locked = false
    }
    else if (!locked) {
      ans = next
    }
  }
  console.log(ans)
}

main()

function solveProblem(problem) {
    // console.log('Problem: ', problem);
    let arr = problem.values;
    let color = 'blue';
    let locked = false;
    for (let i = 0; i < arr.length; i++) {
        // console.log(arr[i]);
        let val = arr[i];

        switch (val) {
            case 'lock':
              locked = true;
              break;
            case 'unlock':
                locked = false;
                break;
            case 'red':
            case 'orange':
            case 'yellow':
            case 'green':
            case 'blue':
            case 'indigo':
            case 'violet':
                if (!locked) {
                    color = val;
                }
              break;
            default:
              //
          }
    }
    console.log(color);
}

function readInput() {
    const readline = require('readline')
    const rl = readline.createInterface({
      input: process.stdin,
      output: process.stdout,
      terminal: false
    })

    let problem = {
      N: 0,
      values: []
    }

    rl.on('line', function (line) {
      // TODO: Process input
      if (problem.N === 0) {
        // Get number of test cases from first line
        problem.N = Number(line)
      } else {
        // TODO process the rest of the data
        // const arr = line.split(' ');
        if (line.length > 0) {
            problem.values.push(line);
        }
      }
    })

    .on('close', () => {
      // Finished processing input, now solve question
      solveProblem(problem)
      process.exit()
    })
  }

readInput()

const readline = require('readline');

let color = null;
let state = 'unlock';
let length = 0;
let msgCounter = 0;
let lastColor = 'blue';
const commandList = [];

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

function checkHistory() {
  commandList.forEach((item, index) => {
    switch (item) {
      case 'lock':
      case 'unlock':
        color = lastColor;
        state = item;
        break;
      default:
        if (state === 'unlock') {
          color = item;
          lastColor = color;
        }
    }
  });
}

rl.on('line', input => {
  if (length === 0) length = +(input);
  else commandList.push(input);

  if (length === msgCounter) {
    checkHistory();
    console.log(color);
    rl.close();
  } else msgCounter++;
});

var readline = require('readline');
var { stdin: input, stdout: output } = require('process');

var rl = readline.createInterface({ input, output });

var isLocked = false;
var currentColor = "blue";

rl.on('line', function foo(input) {
  if (typeof input === "number") {
    return;
  }
  if (input === "lock") {
    isLocked = true;
    return;
  }
  if (input === "unlock") {
    isLocked = false;
    return;
  }
  if (isLocked) {
    return;
  }
  currentColor = input;
});

rl.on('close', function boo(input) {
  console.log(currentColor);
});

var readline = require('readline');
var { stdin: input, stdout: output } = require('process');

var rl = readline.createInterface({ input, output });

var isLocked = false;
var currentColor = "blue";

rl.on('line', function foo(input) {
  if (typeof input === "number") {
    return;
  }
  if (input === "lock") {
    isLocked = true;
    return;
  }
  if (input === "unlock") {
    isLocked = false;
    return;
  }
  if (isLocked) {
    return;
  }
  currentColor = input;
});

rl.on('close', function boo(input) {
  console.log(currentColor);
  rl.close();
});

var readline = require('readline');
var { stdin: input, stdout: output } = require('process');

var rl = readline.createInterface({ input, output });

var isLocked = false;
var currentColor = "blue";

rl.on('line', function foo(input) {
  if (typeof input === "number") {
    return;
  }
  if (input === "lock") {
    isLocked = true;
    return;
  }
  if (input === "unlock") {
    isLocked = false;
    return;
  }
  if (isLocked) {
    return;
  }
  currentColor = input;
});

rl.on('close', function boo(input) {
  rl.write(currentColor);
});

module.exports = function color(...args) {
  let isLocked = false;
  let currentColor = "blue";

  args.forEach((arg) => {
    if (typeof arg === "number") {
      return;
    }
    if (arg === "lock") {
      isLocked = true;
      return;
    }
    if (arg === "unlock") {
      isLocked = false;
      return;
    }
    if (isLocked) {
      return;
    }
    currentColor = arg;
  });

  return currentColor;
}

var readline = require('readline');
var fs = require('fs');
var rl = readline.createInterface({
    input: process.stdin,
    // input: fs.createReadStream('./A.txt'),
    output: process.stdout,
    terminal: false
});

// function A (content) {
//     let currentState = 'unlock'
//     let currentColor = 'blue'
//     for (let i = 0; i < content[0]; i++) {
//         if (i === 0) {
//             continue
//         }
//         if (currentState === 'lock') continue
//         if (content[i] === 'lock' || content[i] === 'unlock') {
//             currentState = content[i]
//             continue
//         }
//         else currentColor = content[i]
//     }
//     return currentColor
// }
//
// module.exports = A

let currentState = 'unlock'
let currentColor = 'blue'
let i = 0

rl
    .on('line', line => {
        if (i === 0) {
            i++
            return
        }
        if (currentState === 'lock') return
        switch (line) {
            case 'lock':
            case 'unlock':
                currentState = line
                return;
            case 'red':
            case 'orange':
            case 'yellow':
            case 'green':
            case 'blue':
            case 'indigo':
            case 'violet':
                currentColor = line
                break
        }
    })
    .on('close', () => {
        process.stdout.write(currentColor)
    })

var readline = require('readline');
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    terminal: false
});

let currentState = 'unlock'
let currentColor = 'blue'
let i = 0

rl
    .on('line', line => {
        if (i === 0) {
            i++
            return
        }
        if (currentState === 'lock') return
        if (line === 'lock' || line === 'unlock') {
            currentState = line
            return
        }
        else currentColor = line
        i++
    })
    .on('close', () => {
        process.stdout.write(currentColor)
    })

const readline = require('readline');
const fs = require('fs');

const readInterface = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    console: false
});

let count = 0;
let quantity = 0;
let flag = false;
let output = 'blue';

readInterface.on('line', function(line) {
    if (count === 0) {
        quantity = line;
    } else {
        switch (line) {
            case 'lock':
                flag = true
                break;
            case 'unlock':
                flag = false
                break;
            case 'red':
            case 'orange':
            case 'yellow':
            case 'green':
            case 'blue':
            case 'indigo':
            case 'violet':
                output = !flag ? line : output;
                break;
        }
    }

    if (count == quantity) {
        console.log('output', output);
    }

    count++;

});

const readline = require('readline');
const fs = require('fs');

const readInterface = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    console: false
});

let count = 0;
let quantity = '';
let flag = false;
let output = 'blue';

readInterface.on('line', function(line) {
    if (count === 0) {
        quantity = line;
    } else {
        switch (line) {
            case 'lock':
                flag = true
                break;
            case 'unlock':
                flag = false
                break;
            case 'red':
            case 'orange':
            case 'yellow':
            case 'green':
            case 'blue':
            case 'indigo':
            case 'violet':
                output = !flag ? line : output;
                break;
        }
    }

    count++

    if (count == quantity) {
        console.log(output);
    }
});

const readline = require('readline');
const fs = require('fs');

const readInterface = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    console: false
});

let count = 0;
let quantity = '';
let flag = false;
let output = 'blue';

readInterface.on('line', function(line) {
    if (count === 0) {
        quantity = line;
    } else {
        switch (line) {
            case 'lock':
                flag = true
                break;
            case 'unlock':
                flag = false
                break;
            default:
                output = !flag ? line : output;
                break;
        }
    }

    count++

    if (count == quantity) {
        console.log(output);
    }
});

const messagesString = `5
lock
unlock
lock
unlock
unlock
`;

const lines = messagesString
    .split('\n')
    .map(line => line.trim())
    .filter(line => line.length > 0);

const count = +lines[0];
const messages = lines.slice(1, count + 1);

const LOCK = 'lock';
const UNLOCK = 'unlock';
const ALLOW_COLORS = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'];

let isLock = false;
let currentColor = 'blue';

messages.forEach((message) => {
    if (message === UNLOCK) {
        isLock = false;
    }

    if (message === LOCK) {
        isLock = true;
    }

    if (ALLOW_COLORS.includes(message) && !isLock) {
        currentColor = message;
    }
});

console.log(currentColor);

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    let lines = i.split(EOL)
    let color = 'blue';
    let status = 'unlock'
    lines = lines.slice(1);
        lines.forEach(item => {
        switch (item) {
            case 'unlock':
                status = 'unlock';
                break;
            case 'lock':
                status = 'lock';
                break;
            default:
                if (status === 'lock') {
                    break;
                } else if (status === 'unlock') {
                    color = item;
                }
        }
    });
    console.log(color);
});

let i = '';
process.stdin.on('data', (c) => (i += c));
process.stdin.on('end', () => {
  const { EOL } = require('os');
  const lines = i.split(EOL);
  const N = parseInt(lines[0]);
  let res = 'blue';
  let isUnlock = true;

  const color = {
    blue: 'blue',
    red: 'red',
    orange: 'orange',
    yellow: 'yellow',
    green: 'green',
    indigo: 'indigo',
    violet: 'violet',
  };

  for (let i = 1; i < N; i++) {
    if (lines[i] === 'lock') {
      isUnlock = false;
    } else if (lines[i] === 'unlock') {
      isUnlock = true;
    }
    if (isUnlock) {
      if (color[lines[i]] != undefined) {
        res = lines[i];
      }
    }
  }

  console.log(res);
});

const nextString = (function() {
  const listeners = [], strings = [], ps = process.stdin
  let last = ''
  ps.setEncoding('utf8')
  ps.on('readable', () => {
    let chunk
    while ((chunk = ps.read()) !== null) {
      chunk = (last + chunk).split(/\r\n|\r|\n/)
      last = chunk[chunk.length - 1]
      for (let i = 0; i < chunk.length - 1; ++i) {
        if (chunk[i].length > 0) {
          if (listeners.length > 0) {
            listeners.shift(1)(chunk[i])
          }
          else {
            strings.push(chunk[i])
          }
        }
      }
    }
  })
  const fn = resolve => {
    if (strings.length > 0) {
      resolve(strings.shift(1))
    }
    else {
      listeners.push(resolve)
    }
  }
  return () => new Promise(fn)
})()

async function main() {
  let n = +await nextString()
  let ans = 'blue'
  let lock = 'lock'
  let unlock = 'unlock'
  let locked = false
  for (let i = 0; i < n; ++i) {
    let next = await nextString()
    if (next === lock) {
      locked = true
    }
    else if (next === unlock) {
      locked = false
    }
    else if (!locked) {
      ans = next
    }
  }
  console.log(next)
}

main()