During the hypnosis session, Nicholas suddenly remembered a positive integer $$$n$$$, which doesn't contain zeros in decimal notation. Soon, when he returned home, he got curious: what is the maximum number of digits that can be removed from the number so that the number becomes not prime, that is, either composite or equal to one?For some numbers doing so is impossible: for example, for number $$$53$$$ it's impossible to delete some of its digits to obtain a not prime integer. However, for all $$$n$$$ in the test cases of this problem, it's guaranteed that it's possible to delete some of their digits to obtain a not prime number.Note that you cannot remove all the digits from the number.A prime number is a number that has no divisors except one and itself. A composite is a number that has more than two divisors. $$$1$$$ is neither a prime nor a composite number.

Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$k$$$ ($$$1 \le k \le 50$$$) — the number of digits in the number. The second line of each test case contains a positive integer $$$n$$$, which doesn't contain zeros in decimal notation ($$$10^{k-1} \le n < 10^{k}$$$). It is guaranteed that it is always possible to remove less than $$$k$$$ digits to make the number not prime. It is guaranteed that the sum of $$$k$$$ over all test cases does not exceed $$$10^4$$$.

For every test case, print two numbers in two lines. In the first line print the number of digits, that you have left in the number. In the second line print the digits left after all delitions.  If there are multiple solutions, print any.

NoteIn the first test case, you can't delete $$$2$$$ digits from the number $$$237$$$, as all the numbers $$$2$$$, $$$3$$$, and $$$7$$$ are prime. However, you can delete $$$1$$$ digit, obtaining a number $$$27 = 3^3$$$.In the second test case, you can delete all digits except one, as $$$4 = 2^2$$$ is a composite number.

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

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

// ************************ Code Start ***************************

function main() {

  var prime=[];
for(var i=2;i<100;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j===0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();

    solution(k,n);

}

function solution(k,n){
    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return;
        }
    }

    for(var m=0;m<k;m++){
        for(var j=m+1;j<k;j++){
            var number=(n[m]-'0')*10+(n[j]-'0')
            if(!prime.includes(number)){
                print('2');
                print(n[m]+n[j]);
                return;
            }
        }
    }
}

}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
const ZERO = '0'.charCodeAt(0);
function solve(n, s) {
    const has = af(10).fill(0);
    for (let i = 0; i < n; i++) {
        let d = s.charCodeAt(i) - ZERO;
        has[d]++;
    }
    //  printf("s %s\nhas %j\n", s, has);
    // case I
    const singles = [1, 4, 6, 8, 9];
    for (let d of singles) {
        if (has[d] > 0) {
            return String(d);
        }
    }
    // case II
    for (let i = 1; i <= 9; i++) {
        if (has[i] > 1) {
            return String([i, i].join(''));
        }
    }
    // case III
    let twopos = s.indexOf('2');
    if (twopos > 0) {
        return s.substring(twopos - 1, twopos + 1);
    }
    let fivepos = s.indexOf('5');
    if (fivepos > 0) {
        return s.substring(fivepos - 1, fivepos + 1);
    }
    // case IV
    for (let i = 0; i < n; i++) {
        for (let j = i + 1; j < n; j++) {
            let x = s.charCodeAt(i) - ZERO;
            let y = s.charCodeAt(j) - ZERO;
            if ((x + y) % 3 == 0) {
                return String([x, y].join(''));
            }
        }
    }
    printf("failed on %s\n", s);
    check(false);
    return 'XXX'; // not reached
}
function main() {
    let tc = nextInt();
    while (tc-- > 0) {
        let n = nextInt();
        let s = nextStr();
        let ans = solve(n, s);
        printf("%d\n", ans.length);
        printf("%s\n", ans);
    }
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
const MAX = 100;
const prime = Array.from({ length: MAX }).fill(true);
const nonprime = [];
function sieve() {
    nonprime.push('1'); // neither prime nor composite
    prime[0] = prime[1] = false;
    for (let i = 2; i < MAX; i++) {
        if (prime[i]) {
            for (let j = i; i * j < MAX; j++) {
                prime[i * j] = false;
            }
        }
        else {
            let j = i;
            let t = [];
            while (j > 0) {
                t.push(String(j % 10));
                j = Math.trunc(j / 10);
            }
            t.reverse();
            nonprime.push(t.join(''));
        }
    }
}
function solve(n, s) {
    for (let t of nonprime) {
        let ok = true;
        let from = 0;
        for (let i = 0; i < t.length; i++) {
            let nl = s.indexOf(t[i], from);
            if (nl == INIT) {
                ok = false;
                break;
            }
            from = nl + 1;
        }
        // printf("s %s t %s ok %d\n", s, t, ok);
        if (ok) {
            printf("%d\n%s\n", t.length, t);
            return;
        }
    }
}
function main() {
    sieve();
    // for (let x of nonprime) {
    //   printf("x %d\n", x);
    // }
    let tc = nextInt();
    while (tc-- > 0) {
        let n = nextInt();
        let s = nextStr();
        solve(n, s);
    }
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
const MAX = 1000;
const prime = Array.from({ length: MAX }).fill(true);
const nonprime = [];
function sieve() {
    nonprime.push('1'); // neither prime nor composite
    prime[0] = prime[1] = false;
    for (let i = 2; i < MAX; i++) {
        if (prime[i]) {
            for (let j = i; i * j < MAX; j++) {
                prime[i * j] = false;
            }
        }
        else {
            let j = i;
            let t = [];
            while (j > 0) {
                t.push(String(j % 10));
                j = Math.trunc(j / 10);
            }
            t.reverse();
            nonprime.push(t.join(''));
        }
    }
}
function solve(n, s) {
    for (let t of nonprime) {
        let ok = true;
        let from = 0;
        for (let i = 0; i < t.length; i++) {
            let nl = s.indexOf(t[i], from);
            if (nl == INIT) {
                ok = false;
                break;
            }
            from = nl + 1;
        }
        // printf("s %s t %s ok %d\n", s, t, ok);
        if (ok) {
            printf("%d\n%s\n", t.length, t);
            return;
        }
    }
}
function main() {
    sieve();
    // for (let x of nonprime) {
    //   printf("x %d\n", x);
    // }
    let tc = nextInt();
    while (tc-- > 0) {
        let n = nextInt();
        let s = nextStr();
        solve(n, s);
    }
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
const MAX = 1000;
const prime = Array.from({ length: MAX }).fill(true);
const comp = [];
function sieve() {
    prime[0] = prime[1] = false;
    for (let i = 2; i < MAX; i++) {
        if (prime[i]) {
            for (let j = i; i * j < MAX; j++) {
                prime[i * j] = false;
            }
        }
        else {
            let j = i;
            let t = [];
            while (j > 0) {
                t.push(String(j % 10));
                j = Math.trunc(j / 10);
            }
            t.reverse();
            comp.push(t.join(''));
        }
    }
}
function solve(n, s) {
    const has = af(10).fill(INIT);
    for (let i = 0; i < n; i++) {
        let d = s.charCodeAt(i) - '0'.charCodeAt(0);
        if (has[d] == INIT) {
            has[d] = i;
        }
    }
    const singles = [1, 4, 6, 8, 9];
    for (let d of singles) {
        if (has[d] != INIT) {
            printf("1\n%d\n", d);
            return;
        }
    }
    for (let t of comp) {
        let ok = true;
        let from = 0;
        for (let i = 0; i < t.length; i++) {
            let nl = s.indexOf(t[i], from);
            if (nl == INIT) {
                ok = false;
                break;
            }
            from = nl + 1;
        }
        // printf("s %s t %s ok %d\n", s, t, ok);
        if (ok) {
            printf("%d\n%s\n", t.length, t);
            return;
        }
    }
}
function main() {
    sieve();
    // for (let x of comp) {
    //   printf("x %d\n", x);
    // }
    let tc = nextInt();
    while (tc-- > 0) {
        let n = nextInt();
        let s = nextStr();
        solve(n, s);
    }
}

"use strict";
const { checkPrime } = require("crypto");
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}

const solve = () => {
  const prime = (n) => {
    for (let i = 2; i * i <= n; i++) {
      if (n % i === 0) return false;
    }
    return true;
  };
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    let arr = readline()
      .trim()
      .split("")
      .map((cur) => parseInt(cur));
    let obj = { 2: 1, 3: 1, 5: 1, 7: 1 },
      flag = 0;
    for (let i = 0; i < n; i++) {
      if (!obj[arr[i]]) {
        flag = 1;
        console.log(1);
        console.log(arr[i]);
        break;
      }
    }
    if (flag === 1) continue;
    for (let i = 0; i < n; i++) {
      let r = arr[i] + "";
      for (let j = i + 1; j < n; j++) {
        let k = r + arr[j];
        if (!prime(parseInt(k))) {
          console.log(k.length);
          console.log(k);
          flag = 1;
          break;
        }
      }
      if (flag === 1) break;
    }
    if (flag === 1) continue;
    console.log(arr.length);
    console.log(arr.join(""));
  }
};
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 k = nextInt();
		var s = next();
		var p = [];
		var output = "";
		for(var i = 0; i < k; i++){
			if(s[i] == "1" || s[i] == "4" || s[i] == "6" || s[i] == "8" || s[i] == "9"){
				output = "1\n" + s[i];
				break;
			}else if(p.indexOf(s[i]) != -1){
				output = "2\n" + s[i] + s[i];
			}else{
				p.push(s[i]);
			}
		}

		if(output == ""){
			for(var i = 0; i < (1 << p.length); i++){
				var v = 0;
				for(var j = 0; j < p.length; j++){
					if((i & (1 << j)) != 0){
						v *= 10;
						v += myconv(p[j], 1);
					}
				}
				if(v >= 10 && !isPrime(v)){
					output = "2\n" + v;
					break;
				}
			}
		}
		myout(output);
	}
}
function isPrime(val){
	if(val == null || val <= 1 || (val != 2 && val % 2 == 0)){
		return false;
	}else if(val == 2){
		return true;
	}
	var root = Math.floor(Math.sqrt(val));
	for(var i = 3; i <= root; i += 2){
		if(val % i == 0){
			return false;
		}
	}
	return true;
}

'use strict'
var os = require('os')
function createInput(t) {
  const n = t.stdin || process.stdin,
    e = /-?\d+/g,
    r = /-?\d+(?:\.\d+)?/g
  let u = [],
    o = 0
  return {
    init: async function () {
      const t = []
      ;(u = await new Promise(e => {
        n.on('data', n => t.push(n)),
          n.on('end', function () {
            const n = t.join('').split(os.EOL)
            e(n)
          })
      })),
        (o = 0)
    },
    dried: function () {
      return o >= u.length
    },
    readLine: c,
    readLineAsNumber: function () {
      return Number(c())
    },
    readIntegersOfLine: function () {
      const t = c().match(e)
      return null == t ? [] : t.map(t => Number(t))
    },
    readNumsOfLine: function () {
      const t = c().match(r)
      return null == t ? [] : t.map(t => Number(t))
    },
  }
  function c() {
    return u[o++]
  }
}
function createOutput(t) {
  const n = t.stdout || process.stdout,
    e = t.encoding || 'ascii',
    r = t.outputBufferThreshold || 1 << 24,
    u = Buffer.alloc(r)
  let o = 0
  return {
    flush: c,
    print: function (t) {
      i('string' == typeof t ? t : t.toString())
    },
    println: function (t) {
      i(('string' == typeof t ? t : t.toString()).concat('\n'))
    },
  }
  function c() {
    n.write(u.toString(e, 0, o)), (o = 0)
  }
  function i(t) {
    const i = Buffer.byteLength(t, e)
    r - o < i && (c(), i >= r) ? n.write(t) : (u.write(t, o, e), (o += i))
  }
}
function createInputAndOutput(t) {
  return {
    ...createInput({ stdin: t.stdin, encoding: t.encoding }),
    ...createOutput({
      stdout: t.stdout,
      encoding: t.encoding,
      outputBufferThreshold: t.outputBufferThreshold,
    }),
  }
}
async function __main__(t, n, e = {}) {
  const r = createInputAndOutput(e)
  await Promise.all([r.init(), Promise.resolve(n && n())]),
    await t(r),
    r.flush()
}
__main__(function (t) {
  const n = t.readLineAsNumber()
  for (let r = 1; r <= n; ++r) {
    const n = e(t.readLineAsNumber(), t.readLine().trim())
    t.println(n.length), t.println(n)
  }
  function e(t, n) {
    for (let e = 0; e < t; ++e) {
      const t = n[e]
      if ('1' === t || '4' === t || '6' === t || '8' === t || '9' === t)
        return t
    }
    const e = [],
      r = [],
      u = new Array(10).fill(!1)
    for (let o = 0; o < t; ++o) {
      const t = n[o],
        c = Number(t)
      if (o > 0) {
        if (2 === c || 5 === c) return n.slice(o - 1, o + 1)
        if (u[c]) return t.concat(t)
      }
      switch (((u[c] = !0), c % 3)) {
        case 1:
          if (r.length > 0) {
            const [e] = r
            return n[e].concat(t)
          }
          e.push(o)
          break
        case 2:
          if (e.length > 0) {
            const [r] = e
            return n[r].concat(t)
          }
          r.push(o)
      }
    }
    for (let u = 0; u < t; ++u) {
      switch (Number(n[u]) % 3) {
        case 1:
          if ((e.push(u), 3 === e.length)) {
            const [t, r, u] = e
            return n[t].concat(n[r]).concat(n[u])
          }
          break
        case 2:
          if ((r.push(u), 3 === r.length)) {
            const [t, e, u] = r
            return n[t].concat(n[e]).concat(n[u])
          }
      }
    }
    return ''
  }
})

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

let edge = true;
let k;

rl.on('line', function(line){
   if(edge) {
     edge = false;
     return;
   }

   if(line.length === 0) {
     return;
   }

   if(!k) {
     k = parseInt(line);
     return;
   }

   const nonPrimeDigit = getNonPrimeDigit(line);
   if(nonPrimeDigit) {
    printAnswer(nonPrimeDigit)

     return;
   }

   const repeated = findRepeatedDigit(line);
   if(repeated) {
     printAnswer(repeated)
     return;
   }

   const twoAndFive = getDivisibleAlways(line);
   if(twoAndFive) {
    printAnswer(twoAndFive)
    return;
  }

  const _27 = findPattern(line, "27")
  if(_27) {
    printAnswer(_27)
    return;
  }

  const _57 = findPattern(line, "57")
  if(_57) {
    printAnswer(_57)
    return;
  }

  console.log(".")

  k = undefined;
})

function printAnswer(ans) {
  console.log(ans.length)
  console.log(ans)
  k = undefined
}

function getNonPrimeDigit(num) {
  for(let i = 0; i < num.length; i++) {
    if(num[i] === "1" || num[i] === "4" || num[i] === "6" || num[i] === "8" || num[i] === "9") {
      return num[i]
    }
  }

  return undefined;
}

function findRepeatedDigit(num) {
  const found = [false, false, false, false, false, false, false, false, false, false];
  for(let i = 0; i < num.length; i++) {
    const index = parseInt(num[i]);
    if(found[index]) {
      return num[i] + num[i];
    }

    found[index] = true;
  }

  return undefined;
}

function getDivisibleAlways(num) {
  for(let i = 1; i < num.length; i++) {
    if(num[i] === "2" || num[i] === "5") {
      return num[i - 1] + num[i];
    }
  }

  return undefined;
}

function findPattern(num, pattern) {
  let indexPattern = 0
  for(let i = 0; i < num.length; i++) {
    if(num[i] === pattern[indexPattern]) {
      indexPattern++
    }

    if(indexPattern === pattern.length) {
      return pattern
    }
  }

  return undefined
}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

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

// ************************ Code Start ***************************

function main() {

  var prime=[];
for(var i=2;i<100;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j===0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();
    print(prime);
    solution(k,n);

}

function solution(k,n){
    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return;
        }
    }

    for(var m=0;m<k-1;m++){
        for(var j=m+1;j<k;j++){
            var number=(n[m]-'0')*10+(n[j]-'0')
            if(!prime.includes(number)){
                print('2');
                print(n[m]+n[j]);
                return;
            }
        }
    }
}

}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

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

// ************************ Code Start ***************************

function main() {

  var prime=[];
for(var i=2;i<100;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j===0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();
    print(prime);
    solution(k,n);

}

function solution(k,n){
    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return;
        }
    }

    for(var m=0;m<k-1;m++){
        for(var j=m+1;j<k;j++){
            var number=(n[m]-'0')*10+(n[j]-'0')
            if(!prime.includes(number)){
                print('2');
                print(n[m]+''+n[j]);
                return;
            }
        }
    }
}

}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

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

// ************************ Code Start ***************************

function main() {

  var prime=[];
for(var i=2;i<100;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j===0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();
    print(prime);
    solution(k,n);

}

function solution(k,n){
    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return;
        }
    }

    for(var m=0;m<k-1;m++){
        for(var j=m+1;j<k;j++){
            print((n[m]-'0')*10+(n[j]-'0'));
            var number=(n[m]-'0')*10+(n[j]-'0')
            if(!prime.includes(number)){
                print('2');
                print(n[m]+''+n[j]);
                return;
            }
        }
    }
}

}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

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

// ************************ Code Start ***************************

function main() {
 var prime=[];
for(var i=2;i<100;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j===0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();

    solution(k,n);

}

function solution(k,n){
    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return;
        }
    }

    for(var i=0;i<k;i++){
        for(var j=i+1;j<k;j++){
            if(!prime[(n[i]-'0')*10+(n[j]-'0')]){
                print('2');
                print(n[i]+''+n[j]);
                return;
            }
        }
    }
}

}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

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

// ************************ Code Start ***************************

function main() {

  var prime=[];
for(var i=2;i<100;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j==0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();

    solution(k,n);

}

function solution(k,n){
    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return;
        }
    }

    for(var i=0;i<k;i++){
        for(var j=i+1;j<k;j++){
            if(!prime[(n[i]-'0')*10+(n[j]-'0')]){
                print('2');
                print(n[i]+''+n[j]);
                return;
            }
        }
    }
}

}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

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

// ************************ Code Start ***************************

function main() {

  var prime=[];
for(var i=2;i<100;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j==0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();

    solution(k,n);

}

function solution(k,n){
    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return;
        }
    }

    for(var i=0;i<k;i++){
        for(var j=i+1;j<k;j++){
            if(!prime[(n[i]-'0')*10+(n[j]-'0')]){
                print('2');
                print(n[i]+n[j]);
                return;
            }
        }
    }
}

}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

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

// ************************ Code Start ***************************

function main() {

  var prime=[];
for(var i=2;i<542;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j==0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();

    solution(k,n);

}

function solution(k,n){
    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return;
        }
    }

    for(var i=0;i<k;i++){
        for(var j=i+1;j<k;j++){
            if(!prime[(n[i]-'0')*10+(n[j]-'0')]){
                print('2');
                print(n[i]+n[j]);
                return;
            }
        }
    }
}

}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

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

// ************************ Code Start ***************************

 var prime=[];
for(var i=2;i<100;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j==0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

function main() {

var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();

    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return;
        }
    }

    for(var i=0;i<k;i++){
        for(var j=i+1;j<k;j++){
            if(!prime[(n[i]-'0')*10+(n[j]-'0')]){
                print('2');
                print(n[i]+n[j]);
                return;
            }
        }
    }

}

}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

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

// ************************ Code Start ***************************
var prime=[];
for(var i=2;i<100;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j==0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

function main() {

 var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();

    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return 0;
        }
    }

    for(var i=0;i<k;i++){
        for(var j=i+1;j<k;j++){
            if(!prime[(n[i]-'0')*10+(n[j]-'0')]){
                print('2');
                print(n[i]+n[j]);
                return 0;
            }
        }
    }

}

}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
const ZERO = '0'.charCodeAt(0);
function solve(n, s) {
    const has = af(10).fill(0);
    for (let i = 0; i < n; i++) {
        let d = s.charCodeAt(i) - ZERO;
        has[d]++;
    }
    printf("s %s\nhas %j\n", s, has);
    // case I
    const singles = [1, 4, 6, 8, 9];
    for (let d of singles) {
        if (has[d] > 0) {
            return String(d);
        }
    }
    // case II
    for (let i = 1; i <= 9; i++) {
        if (has[i] > 1) {
            return String([i, i].join(''));
        }
    }
    // case III
    let twopos = s.indexOf('2');
    if (twopos > 0) {
        return s.substring(twopos - 1, twopos + 1);
    }
    let fivepos = s.indexOf('5');
    if (fivepos > 0) {
        printf("fivepos %d\n", fivepos);
        return s.substring(fivepos - 1, fivepos + 1);
    }
    // case IV
    for (let i = 0; i < n; i++) {
        for (let j = i + 1; j < n; j++) {
            let x = s.charCodeAt(i) - ZERO;
            let y = s.charCodeAt(j) - ZERO;
            if ((x + y) % 3 == 0) {
                return String([x, y].join(''));
            }
        }
    }
    printf("failed on %s\n", s);
    check(false);
    return 'XXX'; // not reached
}
function main() {
    let tc = nextInt();
    while (tc-- > 0) {
        let n = nextInt();
        let s = nextStr();
        let ans = solve(n, s);
        printf("%d\n", ans.length);
        printf("%s\n", ans);
    }
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
const ZERO = '0'.charCodeAt(0);
function solve(n, s) {
    const has = af(10).fill(0);
    for (let i = 0; i < n; i++) {
        let d = s.charCodeAt(i) - ZERO;
        has[d]++;
    }
    //  printf("s %s\nhas %j\n", s, has);
    // case I
    const singles = [1, 4, 6, 8, 9];
    for (let d of singles) {
        if (has[d] > 0) {
            return String(d);
        }
    }
    // case II
    let twopos = s.indexOf('2');
    if (twopos > 0) {
        return s.substring(twopos - 1, 2);
    }
    let fivepos = s.indexOf('5');
    if (fivepos > 0) {
        return s.substring(fivepos - 1, 2);
    }
    // case II
    for (let i = 0; i <= 9; i++) {
        if (has[i] > 1) {
            return String([i, i].join(''));
        }
    }
    // case IV
    for (let i = 0; i < n; i++) {
        for (let j = i + 1; j < n; j++) {
            let x = s.charCodeAt(i) - ZERO;
            let y = s.charCodeAt(j) - ZERO;
            if ((x + y) % 3 == 0) {
                return String([x, y].join(''));
            }
        }
    }
    printf("failed on %s\n", s);
    check(false);
    return 'XXX'; // not reached
}
function main() {
    let tc = nextInt();
    while (tc-- > 0) {
        let n = nextInt();
        let s = nextStr();
        let ans = solve(n, s);
        printf("%d\n", ans.length);
        printf("%s\n", ans);
    }
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
const MAX = 1000;
const prime = Array.from({ length: MAX }).fill(true);
const comp = [];
function sieve() {
    prime[0] = prime[1] = false;
    for (let i = 2; i < MAX; i++) {
        if (prime[i]) {
            for (let j = i; i * j < MAX; j++) {
                prime[i * j] = false;
            }
        }
        else {
            let j = i;
            let t = [];
            while (j > 0) {
                t.push(String(j % 10));
                j = Math.trunc(j / 10);
            }
            t.reverse();
            comp.push(t.join(''));
        }
    }
}
function solve(n, s) {
    for (let t of comp) {
        let ok = true;
        let from = 0;
        for (let i = 0; i < t.length; i++) {
            let nl = s.indexOf(t[i], from);
            if (nl == INIT) {
                ok = false;
                break;
            }
            from = nl + 1;
        }
        // printf("s %s t %s ok %d\n", s, t, ok);
        if (ok) {
            printf("%d\n%s\n", t.length, t);
            return;
        }
    }
}
function main() {
    sieve();
    // for (let x of comp) {
    //   printf("x %d\n", x);
    // }
    let tc = nextInt();
    while (tc-- > 0) {
        let n = nextInt();
        let s = nextStr();
        solve(n, s);
    }
}

"use strict";
const { checkPrime } = require("crypto");
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}

const solve = () => {
  const prime = (n) => {
    for (let i = 2; i * i <= n; i++) {
      if (n % i === 0) return false;
    }
    return true;
  };
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    let arr = readline()
      .trim()
      .split("")
      .map((cur) => parseInt(cur));
    let obj = { 2: 1, 3: 1, 5: 1, 7: 1 },
      flag = 0;
    for (let i = 0; i < n; i++) {
      if (!obj[arr[i]]) {
        flag = 1;
        console.log(1);
        console.log(arr[i]);
        break;
      }
    }
    if (flag === 1) continue;
    arr.sort((a, b) => a - b);
    for (let i = 0; i < n; i++) {
      let r = arr[i] + "";
      for (let j = i + 1; j < n; j++) {
        let k = r + arr[j];
        if (!prime(parseInt(k))) {
          console.log(k.length);
          console.log(k);
          flag = 1;
        }
      }
      if (flag === 1) break;
    }
  }
};
solve();

"use strict";
const { checkPrime } = require("crypto");
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}

const solve = () => {
  const prime = (n) => {
    for (let i = 2; i * i <= n; i++) {
      if (n % i === 0) return false;
    }
    return true;
  };
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    let arr = readline()
      .trim()
      .split("")
      .map((cur) => parseInt(cur));
    let obj = { 2: 1, 3: 1, 5: 1, 7: 1 },
      flag = 0;
    for (let i = 0; i < n; i++) {
      if (!obj[arr[i]]) {
        flag = 1;
        console.log(1);
        console.log(arr[i]);
        break;
      }
    }
    if (flag === 1) continue;
    let r = "";
    for (let i = 0; i < n; i++) {
      r += arr[i];
      for (let j = i + 1; j < n; j++) {
        let k = r + arr[j];
        if (!prime(parseInt(k))) {
          console.log(k.length);
          console.log(k);
          flag = 1;
          break;
        }
      }
      if (flag === 1) break;
    }
    if (flag === 1) continue;
    console.log(arr.length);
    console.log(arr.join(""));
  }
};
solve();

"use strict";
const { checkPrime } = require("crypto");
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}

const solve = () => {
  const prime = (n) => {
    for (let i = 2; i * i <= n; i++) {
      if (n % i === 0) return false;
    }
    return true;
  };
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    let arr = readline()
      .trim()
      .split("")
      .map((cur) => parseInt(cur));
    let obj = { 2: 1, 3: 1, 5: 1, 7: 1 },
      flag = 0;
    for (let i = 0; i < n; i++) {
      if (!obj[arr[i]]) {
        flag = 1;
        console.log(1);
        console.log(arr[i]);
        break;
      }
    }
    if (flag === 1) continue;
    let r = arr[0] + "";
    for (let i = 1; i < n; i++) {
      r += arr[i];
      if (!prime(parseInt(r))) {
        console.log(r.length);
        console.log(r);
        flag = 1;
      }
    }
    if (flag === 1) continue;
    console.log(arr.length);
    console.log(arr.join(""));
  }
};
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 k = nextInt();
		var s = next();
		var p = [];
		var output = "";
		for(var i = 0; i < k; i++){
			if(s[i] == "1" || s[i] == "4" || s[i] == "6" || s[i] == "8" || s[i] == "9"){
				output = "1\n" + s[i];
				break;
			}else if(p.indexOf(s[i]) != -1){
				output = "2\n" + s[i] + s[i];
				break;
			}else{
				p.push(s[i]);
			}
		}
		if(output == ""){
			for(var i = 1; i < (1 << p.length); i++){
				var v = 0;
				for(var j = 0; j < p.length; j++){
					if((i & (1 << j)) != 0){
						v *= 10;
						v += myconv(p[j], 1);
					}
				}
				if(v >= 10 && !isPrime(v)){
					output = "2\n" + v;
					break;
				}
			}
		}
		myout(output);
	}
}
function isPrime(val){
	if(val == null || val <= 1 || (val != 2 && val % 2 == 0)){
		return false;
	}else if(val == 2){
		return true;
	}
	var root = Math.floor(Math.sqrt(val));
	for(var i = 3; i <= root; i += 2){
		if(val % i == 0){
			return false;
		}
	}
	return true;
}

//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 k = nextInt();
		var s = next();
		var p = [];
		var output = "";
		for(var i = 0; i < k; i++){
			if(s[i] == "1" || s[i] == "4" || s[i] == "6" || s[i] == "8" || s[i] == "9"){
				output = "1\n" + s[i];
				break;
			}else if(p.indexOf(s[i]) != -1){
				output = "2\n" + s[i] + s[i];
				break;
			}else{
				p.push(myconv(s[i], 1));
			}
		}
		if(output == ""){
			for(var i = 1; i < (1 << p.length); i++){
				var v = 0;
				for(var j = 0; j < p.length; j++){
					if((i & (1 << j)) != 0){
						v *= 10;
						v += p[j];
					}
				}
				if(!isPrime(v)){
					output = "2\n" + v;
					break;
				}
			}
		}
		myout(output);
	}
}
function isPrime(val){
	if(val == null || val <= 1 || (val != 2 && val % 2 == 0)){
		return false;
	}else if(val == 2){
		return true;
	}
	var root = Math.floor(Math.sqrt(val));
	for(var i = 3; i <= root; i += 2){
		if(val % i == 0){
			return false;
		}
	}
	return true;
}

'use strict'
var os = require('os')
function createInput(n) {
  const t = n.stdin || process.stdin,
    e = /-?\d+/g,
    r = /-?\d+(?:\.\d+)?/g
  let u = [],
    i = 0
  return {
    init: async function () {
      const n = []
      ;(u = await new Promise(e => {
        t.on('data', t => n.push(t)),
          t.on('end', function () {
            const t = n.join('').split(os.EOL)
            e(t)
          })
      })),
        (i = 0)
    },
    dried: function () {
      return i >= u.length
    },
    readLine: o,
    readLineAsNumber: function () {
      return Number(o())
    },
    readIntegersOfLine: function () {
      const n = o().match(e)
      return null == n ? [] : n.map(n => Number(n))
    },
    readNumsOfLine: function () {
      const n = o().match(r)
      return null == n ? [] : n.map(n => Number(n))
    },
  }
  function o() {
    return u[i++]
  }
}
function createOutput(n) {
  const t = n.stdout || process.stdout,
    e = n.encoding || 'ascii',
    r = n.outputBufferThreshold || 1 << 24,
    u = Buffer.alloc(r)
  let i = 0
  return {
    flush: o,
    print: function (n) {
      s('string' == typeof n ? n : n.toString())
    },
    println: function (n) {
      s(('string' == typeof n ? n : n.toString()).concat('\n'))
    },
  }
  function o() {
    t.write(u.toString(e, 0, i)), (i = 0)
  }
  function s(n) {
    const s = Buffer.byteLength(n, e)
    r - i < s && (o(), s >= r) ? t.write(n) : (u.write(n, i, e), (i += s))
  }
}
function createInputAndOutput(n) {
  return {
    ...createInput({ stdin: n.stdin, encoding: n.encoding }),
    ...createOutput({
      stdout: n.stdout,
      encoding: n.encoding,
      outputBufferThreshold: n.outputBufferThreshold,
    }),
  }
}
async function __main__(n, t, e = {}) {
  const r = createInputAndOutput(e)
  await Promise.all([r.init(), Promise.resolve(t && t())]),
    await n(r),
    r.flush()
}
__main__(function (n) {
  const t = n.readLineAsNumber()
  for (let r = 1; r <= t; ++r) {
    const t = e(n.readLineAsNumber(), n.readLine().trim())
    n.println(t.length), n.println(t.join(''))
  }
  function e(n, t) {
    const e = new Array(10).fill(!1),
      r = [],
      u = []
    for (let i = 0; i < n; ++i) {
      const n = Number(t[i])
      if (1 === n || 4 === n || 6 === n || 8 === n || 9 === n) return [n]
      if (i > 0) {
        if (2 === n || 5 === n) return [Number(t[i - 1]), n]
        if (e[n]) return [n, n]
      }
      switch (((e[n] = !0), n % 3)) {
        case 1:
          if ((r.push(i), 3 === r.length)) {
            const [n, e, u] = r
            return [Number(t[n]), Number(t[e]), Number(t[u])]
          }
          if (u.length > 0) {
            const [e] = u
            return [Number(t[e]), n]
          }
          break
        case 2:
          if ((u.push(i), 3 === u.length)) {
            const [n, e, r] = u
            return [Number(t[n]), Number(t[e]), Number(t[r])]
          }
          if (r.length > 0) {
            const [e] = r
            return [Number(t[e]), n]
          }
      }
    }
    return []
  }
})