process.stdin.resume(); process.stdin.setEncoding('ascii'); var input_stdin = ""; var input_stdin_array = ""; var input_currentline = 0; process.stdin.on('data', function (data) { input_stdin += data; }); process.stdin.on('end', function () { input_stdin_array = input_stdin.split("\n"); main(); }); function readLine() { return input_stdin_array[input_currentline++]; } /////////////// ignore above this line //////////////////// function canConstruct(a) { // Return "Yes" or "No" denoting whether you can construct the required number. for (let count = 0; count < a.length; count++) { var combinedNum = a.join(''); var convertNum = Number(combinedNum); if (a[count] % 3 == 0) { return 'Yes'; } else if (convertNum % 3 == 0){ return 'Yes'; } } return 'No'; } function main() { var t = parseInt(readLine()); for(var a0 = 0; a0 < t; a0++){ var n = parseInt(readLine()); a = readLine().split(' '); a = a.map(Number); var result = canConstruct(a); process.stdout.write("" + result + "\n"); } }