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.


-----Input-----

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$.


-----Output-----

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.


-----Examples-----

Input
7
3
237
5
44444
3
221
2
35
3
773
1
4
30
626221626221626221626221626221
Output
2
27
1
4
1
1
2
35
2
77
1
4
1
6


-----Note-----

In 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.

Difficulty: EASY

Solutions:
def Composite(numList):
	aloneList = ['1', '4', '6', '8', '9']
	for num in numList:
		if num in aloneList:
			return (1, num)
	if numList in ['23', '37', '53', '73']:
		return 'any'
	if '2' in numList[1:]:
		return (2, numList[0] + '2')
	if '5' in numList[1:]:
		return (2, numList[0] + '5')
	if numList[0] == '2':
		if '7' in numList[1:]:
			return (2, '27')
		elif '3' in numList[1:]:
			return (2, '33')
	if numList[0] == '3':
		if '3' in numList[1:]:
			return (2, '33')
		elif '7' in numList[1:]:
			return (2, '77')
	if numList[0] == '5':
		if '7' in numList[1:]:
			return (2, '57')
		elif '3' in numList[1:]:
			return (2, '33')
	if numList[0] == '7':
		if '7' in numList[1:]:
			return (2, '77')
		elif '3' in numList[1:]:
			return (2, '33')
N = int(input())
for _ in range(N):
	n = input()
	numList = input()
	(l, ans) = Composite(numList)
	print(l)
	print(ans)


def contest():
	n = int(input())
	s = input()
	res = ''
	one_numbers = ['1', '4', '6', '8', '9']
	hist = {'2': 0, '3': 0, '5': 0, '7': 0}
	some_num = {'2': ['2', '5', '7'], '3': ['2', '3', '5'], '5': ['2', '5', '7'], '7': ['2', '5', '7']}
	first2357 = set()
	for i in s:
		if i in one_numbers:
			print(1)
			print(i)
			return
		else:
			for firstdigit in first2357:
				if i in some_num[firstdigit]:
					res = firstdigit + i
			first2357.add(i)
	print(2)
	print(res)
for _ in range(int(input())):
	contest()


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()
from collections import defaultdict
T = int(input())
for _ in range(T):
	n = int(input())
	s = list(input())
	onedigit = ['2', '3', '5', '7']
	ans = -1
	G = defaultdict(lambda : 0)
	for a in s:
		if a not in onedigit:
			ans = int(a)
			break
		G[a] += 1
	if ans != -1:
		print(1)
		print(ans)
	else:
		for a in s:
			G[a] -= 1
			if a == '2' and G['5'] != 0:
				ans = 25
				break
			if a == '2' and G['2'] != 0:
				ans = 22
				break
			if a == '2' and G['7'] != 0:
				ans = 27
				break
			if a == '3' and G['5'] != 0:
				ans = 35
				break
			if a == '3' and G['2'] != 0:
				ans = 32
				break
			if a == '3' and G['3'] != 0:
				ans = 33
				break
			if a == '5' and G['5'] != 0:
				ans = 55
				break
			if a == '5' and G['2'] != 0:
				ans = 52
				break
			if a == '5' and G['7'] != 0:
				ans = 57
				break
			if a == '7' and G['5'] != 0:
				ans = 75
				break
			if a == '7' and G['2'] != 0:
				ans = 72
				break
			if a == '7' and G['7'] != 0:
				ans = 77
				break
		print(2)
		print(ans)


import math
for i in range(int(input())):
	k = int(input())
	n_in = str(input())
	found_ans = False
	for ele in n_in:
		if ele == '1' or ele == '4' or ele == '6' or (ele == '8') or (ele == '9'):
			found_ans = True
			break
	if found_ans:
		print('1')
		print(ele)
	else:
		dict_occur = {}
		marked_dup = -1
		for ele in n_in:
			if ele == '2' or ele == '3' or ele == '5' or (ele == '7'):
				if ele not in dict_occur:
					dict_occur[ele] = 0
				dict_occur[ele] += 1
				if dict_occur[ele] >= 2:
					marked_dup = ele
					break
		print('2')
		if marked_dup != -1:
			print(ele + ele)
		elif '2' in n_in:
			if n_in[0] != '2':
				print(n_in[0] + '2')
			elif '7' in n_in:
				print('27')
			elif '5' in n_in:
				print('25')
		elif '5' in n_in:
			if n_in[0] != '5':
				print(n_in[0] + '5')
			elif '7' in n_in:
				print('57')
			elif '2' in n_in:
				print('52')


def entradasF():
	entradas = []
	t = int(input())
	for caso in range(0, t):
		entrada1 = int(input())
		entrada2 = int(input())
		entrada_temp = [entrada1, entrada2]
		entradas.append(entrada_temp)
	return entradas

def proceso(numero, digitos):
	primos = [2, 3, 5, 7]
	primosPropios = []
	contador_primos = 0
	for digito in str(numero):
		if primos.count(int(digito)):
			contador_primos += 1
			primosPropios.append(digito)
		else:
			return int(digito)
	if digitos == 1 or len(primosPropios) == 2:
		return numero
	if contador_primos == digitos:
		for i in primosPropios:
			primosAlternos = primosPropios
			primosAlternos.remove(i)
			for j in primosAlternos:
				numTemp = int(f'{i}{j}')
				divisores = 0
				for n in range(1, numTemp + 1):
					if numTemp % n == 0:
						divisores += 1
				if divisores > 2:
					return numTemp

def main():
	entradas = entradasF()
	for entrada in entradas:
		numero = proceso(entrada[1], entrada[0])
		digitos = len(str(numero))
		print(digitos)
		print(numero)
main()


for _ in range(int(input())):
	k = int(input())
	n = str(input())
	contin = True
	tmp = {'2': 0, '3': 0, '5': 0, '7': 0}
	for i in n:
		if i not in ['2', '3', '5', '7']:
			print('1')
			print(i)
			contin = False
			break
		else:
			tmp[i] += 1
	if contin:
		print('2')
		if tmp['2'] > 1:
			print('22')
		elif tmp['3'] > 1:
			print('33')
		elif tmp['5'] > 1:
			print('55')
		elif tmp['7'] > 1:
			print('77')
		elif n[0] == '2':
			if tmp['5'] == 1:
				print(25)
			else:
				print(27)
		elif n[0] == '3':
			if tmp['5'] == 1:
				print(35)
			else:
				print(32)
		elif n[0] == '7':
			if tmp['5'] == 1:
				print(75)
			else:
				print(72)
		elif tmp['2'] == 1:
			print(52)
		else:
			print(57)


for _ in range(int(input())):
	n = int(input())
	s = input()
	arr = ['1', '4', '6', '8', '9']
	f = 0
	out = [-1, -1]
	for i in s:
		if i in arr:
			out[0] = 1
			out[1] = int(i)
			f = 1
			break
		if f == 1:
			break
	if f == 1:
		print(out[0])
		print(out[1])
		continue
	arr = ['23', '37', '53', '73']
	f = 0
	for i in range(n - 1):
		for j in range(i + 1, n):
			if s[i] + s[j] not in arr:
				out[0] = 2
				out[1] = int(s[i] + s[j])
				f = 1
				break
		if f == 1:
			break
	print(out[0])
	print(out[1])


for _ in range(int(input())):
	k = int(input())
	num = input()
	num_s = 0
	mark = 0
	for i in range(len(num)):
		if num[i] != '2' and num[i] != '3' and (num[i] != '5') and (num[i] != '7'):
			num_s = num[i]
			mark = 1
			break
	if mark == 0:
		for i in range(len(num) - 1):
			if mark == 1:
				break
			if num[i] == '2' or num[i] == '5' or num[i] == '7':
				for j in range(i + 1, len(num)):
					if num[j] != '3':
						num_s = num[i] + num[j]
						mark = 1
						break
			if num[i] == '3':
				for j in range(i + 1, len(num)):
					if num[j] != '7':
						num_s = num[i] + num[j]
						mark = 1
						break
	if mark == 0:
		num_s = num
	print(len(num_s))
	print(num_s)


t = int(input())
a = [0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101]
for _ in range(t):
	k = int(input())
	n = input()
	f = 0
	for i in range(k):
		if int(n[i]) not in a:
			print(1)
			print(n[i])
			f = 1
			break
	if f == 0:
		for i in range(k - 1):
			if f == 0:
				for j in range(i + 1, k):
					if int(n[i] + n[j]) not in a:
						print(2)
						print(n[i] + n[j])
						f = 1
						break
			else:
				break
		if f == 0:
			print(n)


t = int(input())
while t:
	k = int(input())
	l = list(input()[:k])
	f = 0
	for i in range(k):
		if l[i] in ['1', '4', '6', '8', '9']:
			print(1)
			print(int(l[i]))
			f = 1
			break
	if f == 0:
		print(2)
		j = 0
		while j < k:
			if l[j] == '2':
				for i in range(j + 1, k):
					if l[i] in ['2', '5', '7']:
						print(''.join('2' + l[i]))
						f = 1
						break
			elif l[j] == '3':
				for i in range(j + 1, k):
					if l[i] in ['2', '5', '3']:
						print(''.join('3' + l[i]))
						f = 1
						break
			elif l[j] == '5':
				for i in range(j + 1, k):
					if l[i] in ['2', '5', '7']:
						print(''.join('5' + l[i]))
						f = 1
						break
			else:
				for i in range(j + 1, k):
					if l[i] in ['2', '5', '7']:
						print(''.join('7' + l[i]))
						f = 1
						break
			if f == 1:
				break
			j += 1
	t -= 1


import os, sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import ceil
mod = 10 ** 9 + 7

def prime(number):
	i = 2
	while i * i <= number:
		if number % i == 0:
			return False
		i += 1
	return True
for _ in range(int(input())):
	k = int(input())
	num = input()
	memo = {}
	f = 0
	for i in num:
		if i == '1':
			print(1)
			print(1)
			f = 1
			break
		if not prime(int(i)):
			print(1)
			print(i)
			f = 1
			break
		if i not in memo:
			memo[i] = 1
		else:
			memo[i] += 1
	if f:
		continue
	f = 0
	for i in range(k - 1):
		for j in range(i + 1, k):
			if not prime(int(num[i]) * 10 + int(num[j])):
				print(2)
				print(num[i] + num[j])
				f = 1
				break
		if f:
			break


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class RangeQuery:

	def __init__(self, data, func=min):
		self.func = func
		self._data = _data = [list(data)]
		(i, n) = (1, len(_data[0]))
		while 2 * i <= n:
			prev = _data[-1]
			_data.append([func(prev[j], prev[j + i]) for j in range(n - 2 * i + 1)])
			i <<= 1

	def query(self, start, stop):
		depth = (stop - start).bit_length() - 1
		return self.func(self._data[depth][start], self._data[depth][stop - (1 << depth)])

	def __getitem__(self, idx):
		return self._data[0][idx]

def check(st, n, k):
	for i in range(n - k + 1):
		g = st.query(i, i + k)
		if g > 1:
			return True
	return False
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict, deque
from math import ceil, floor, sqrt, log2, gcd, pi
from heapq import heappush, heappop
from fractions import Fraction
from bisect import bisect_left, bisect, bisect_right
from itertools import combinations_with_replacement, permutations
import sys
from copy import deepcopy
abc = 'abcdefghijklmnopqrstuvwxyz'
ABC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
prime = [1 for i in range(100000)]
prime[0] = 0
prime[1] = 0

def seive(N):
	p = 2
	while p * p <= N:
		if prime[p] == 1:
			for i in range(p * p, N + 1, p):
				prime[i] = 0
		p += 1
seive(77777)
for _ in range(int(input())):
	n = int(input())
	s = input()
	d = defaultdict(int)
	a = ['4', '6', '8', '9', '1']
	flag = 0
	for i in a:
		if i in s:
			print(1)
			print(i)
			flag = 1
			break
	if flag == 1:
		continue
	elif flag == 0:
		s_ = ''
		for i in s:
			if i not in a:
				s_ += i
		for i in s_:
			d[i] += 1
		flag2 = 0
		for i in d:
			if d[i] > 1:
				print(2)
				print(i + i)
				flag2 = 1
				break
		if flag2 == 0:
			req = []
			for i in range(len(s_)):
				for j in range(i + 1, len(s_)):
					req.append(s[i] + s[j])
			if len(s_) > 2:
				for i in range(len(s_)):
					for j in range(i + 1, len(s_)):
						for k in range(j + 1, len(s_)):
							req.append(s[i] + s[j] + s[k])
			ar = ['25', '27', '22', '32', '33', '35', '52', '55', '57', '72', '75']
			flag3 = 0
			for i in ar:
				if i in req:
					print(2)
					print(i)
					flag3 = 1
					break
			if flag3 == 0:
				print(3)
				print(req[-1])


import re
n = int(input())
for _ in range(n):
	l = int(input())
	num = str(input())
	a = re.findall('([14689])', num)
	b = re.findall('(2.*2|2.*5|2.*7|3.*2|3.*3|3.*5|5.*2|5.*5|5.*7|7.*2|7.*5|7.*7)', num)
	if a != [] and a[0] != '':
		print(1)
		print(a[0])
	elif b != [] and b[0] != '':
		print(2)
		print(b[0][0] + b[0][-1])


n = int(input())
for i in range(n):
	t = int(input())
	s = list(input())
	e = ['1', '4', '6', '8', '9']
	ans = None
	for j in range(t):
		if s[j] in e:
			ans = s[j]
			break
	if ans == None:
		comb = [['2', '2'], ['2', '5'], ['2', '7'], ['3', '2'], ['3', '3'], ['3', '5'], ['5', '2'], ['5', '5'], ['5', '7'], ['7', '2'], ['7', '5'], ['7', '7']]
		for j in range(12):
			if comb[j][0] in s:
				a = s.index(comb[j][0])
				s1 = s[a + 1:]
				if comb[j][1] in s1:
					ans = comb[j][0] + comb[j][1]
					break
	print(len(ans))
	print(ans)


import sys
input = sys.stdin.readline

def getInt():
	return int(input())

def getVars():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))

def getStr():
	return input().strip()
t = getInt()
for _ in range(t):
	k = getInt()
	s = getStr()
	n = len(s)
	ans = []
	t = [0] * 10
	for i in range(n):
		if int(s[i]) in [1, 4, 6, 8, 9]:
			ans = s[i]
			break
		elif i > 0 and int(s[i]) in [2, 5]:
			ans = (s[i - 1], s[i])
		else:
			t[int(s[i])] += 1
			if t[3] == 2:
				ans = ('3', '3')
			elif t[7] == 2:
				ans = ('7', '7')
	if len(ans) != 0:
		print(len(ans))
		print(''.join(ans))
	else:
		print(2)
		if n == 2:
			print(s)
		elif n == 3:
			print(s[0] + '7')


t = int(input())
for i in range(t):
	k = int(input())
	n = list(input())
	if '4' in n:
		print(1)
		print(4)
	elif '6' in n:
		print(1)
		print(6)
	elif '8' in n:
		print(1)
		print(8)
	elif '9' in n:
		print(1)
		print(9)
	elif '1' in n:
		print(1)
		print(1)
	elif '5' in n:
		print(2)
		c = n.index('5')
		if c == 0:
			if n[1] == '3':
				if len(n) > 2 and n[2] == '7':
					print(57)
				else:
					print(''.join(n[1:3]))
			else:
				print(''.join(n[:2]))
		else:
			print(''.join(n[c - 1:c + 1]))
	elif '2' in n:
		print(2)
		c = n.index('2')
		if c == 0:
			if n[1] == '3':
				if len(n) > 2 and n[2] == '7':
					print(27)
				else:
					print(''.join(n[1:3]))
			else:
				print(''.join(n[0:2]))
		else:
			print(''.join(n[c - 1:c + 1]))
	else:
		print(2)
		c3 = n.count('3')
		c7 = n.count('7')
		if c3 > 1:
			print(33)
		elif c7 > 1:
			print(77)


from itertools import combinations_with_replacement
t = int(input())
table = {1: False, 2: True, 3: True, 4: False, 5: True, 6: False, 7: True, 8: False, 9: False}
not_in = [23, 37, 53, 73]

def f(k, n):
	for c in n:
		if not table[int(c)]:
			print(1)
			print(c)
			return
	for i in range(0, k - 1):
		for j in range(i + 1, k):
			p = int(''.join([n[i], n[j]]))
			if not p in not_in:
				print(2)
				print(p)
				return
for _ in range(t):
	k = int(input())
	n = input()
	f(k, n)


import sys
import os.path
from collections import *
import math
import bisect
import heapq as hq
from fractions import Fraction
from random import randint
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
input = sys.stdin.readline

def isPrime(n):
	if n <= 1:
		return False
	for i in range(2, n):
		if n % i == 0:
			return False
	return True

def solve():
	k = int(input())
	s = list(input().strip('\n'))
	for i in s:
		if i == '1' or i == '4' or i == '6' or (i == '8') or (i == '9'):
			print(1)
			print(i)
			return
	for i in range(k):
		for j in range(i + 1, k):
			x = int(s[i]) * 10 + int(s[j])
			if not isPrime(x):
				print(2)
				print(x)
				return
t = int(input())
while t:
	t -= 1
	solve()


from math import sqrt

def isprime(n):
	res = True
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			res = False
			break
	return res
for _ in range(int(input())):
	k = int(input())
	num = input()
	found = False
	if len(num) == 2:
		(fr, se) = (num[0], num[1])
		if fr in ['2', '3', '5', '7'] and se in ['2', '3', '5', '7']:
			found = True
			print(2)
			print(int(num))
	if not found:
		res = False
		for i in num:
			if i in ['1', '4', '6', '8', '9']:
				res = True
				print(1)
				print(i)
				break
		if not res:
			l = list(num)
			(a, b, c) = (int(l[0] + l[1]), int(l[1] + l[2]), int(l[0] + l[2]))
			for i in [a, b, c]:
				if not isprime(i):
					print(2)
					print(int(i))
					break


class Solution:

	def __init__(self):
		self.prime = [1] * 101
		for i in range(2, 100, 1):
			j = i * 2
			count = 2
			while j <= len(self.prime):
				self.prime[j] = 0
				count += 1
				j = i * count

	def solve(self, n):
		n = str(n)
		for i in range(len(n)):
			if n[i] in '14689':
				print(1)
				print(n[i])
				return 1
		for i in range(len(n)):
			for j in range(i + 1, len(n), 1):
				if self.prime[int(n[i] + n[j])]:
					continue
				else:
					print(2)
					print(n[i] + n[j])
					return 1
obj = Solution()
t = int(input())
for _ in range(t):
	x = int(input())
	n = int(input())
	obj.solve(n)


for _ in range(int(input())):
	n = int(input())
	s = str(input())
	l = ['4', '6', '8', '9', '1']
	c = True
	ll = ['15', '27', '51', '52', '32', '12', '21', '57', '77', '33', '22', '35', '55', '75', '72', '25']
	for i in l:
		if i in s:
			print(1)
			print(i)
			c = False
			break
	if c == True:
		for i in ll:
			x = s.find(i[0])
			if x != -1:
				if i[1] in s[x + 1:]:
					print(2)
					print(i)
					break


r = [i for i in range(100)]
r[1] = 0
for i in range(100):
	if r[i]:
		for j in range(i + i, 100, i):
			r[j] = 0
r = set(r)
for _ in range(int(input())):
	n = int(input())
	s = '0' + input()
	b = 0
	for i in range(n + 1):
		if b:
			break
		for j in range(i + 1, n + 1):
			if int(s[i] + s[j]) not in r:
				print(len(str(int(s[i] + s[j]))))
				print(int(s[i] + s[j]))
				b = 1
				break


import math
import os
import sys
from sys import *
from decimal import *
from io import BytesIO, IOBase
from itertools import *
from collections import *
import random
M = 10 ** 9 + 7
import heapq
import bisect
from functools import lru_cache
from queue import PriorityQueue
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def inpu():
	return int(inp())

def luckynumber(x, n, a):
	if x > 0:
		a.append(x)
	if x > 10 ** 9:
		return a
	elif x < 1000000000000.0:
		luckynumber(x * 10 + 4, n, a)
		luckynumber(x * 10 + 7, n, a)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def query1(l, r):
	if l >= r:
		return -1
	print('?', l + 1, r + 1)
	sys.stdout.flush()
	return int(input()) - 1

def answer(p):
	print('!', p + 1)
	sys.stdout.flush()
	exit()

def rse(arr, n):
	stack = []
	ans = []
	for i in range(n - 1, -1, -1):
		if len(stack) == 0:
			ans.append(n)
		else:
			while len(stack) != 0:
				if stack[-1][0] >= arr[i]:
					stack.pop()
				else:
					break
			if len(stack) == 0:
				ans.append(n)
			else:
				ans.append(stack[-1][1])
		stack.append([arr[i], i])
	ans.reverse()
	return ans

def lse(arr, n):
	stack = []
	ans = []
	for i in range(n):
		if len(stack) == 0:
			ans.append(-1)
		else:
			while len(stack) != 0:
				if stack[-1][0] >= arr[i]:
					stack.pop()
				else:
					break
			if len(stack) == 0:
				ans.append(-1)
			else:
				ans.append(stack[-1][1])
		stack.append([arr[i], i])
	return ans

def mah(arr):
	max1 = 0
	p = rse(arr, len(arr))
	q = lse(arr, len(arr))
	for i in range(len(arr)):
		a = (p[i] - q[i] - 1) * arr[i]
		max1 = max(a, max1)
	return max1

def maxSumIS(arr, n):
	msis = arr.copy()
	for i in range(1, n):
		for j in range(i):
			if arr[i] > arr[j] and msis[i] < msis[j] + arr[i]:
				msis[i] = msis[j] + arr[i]
	c = max(msis)
	p = 5
	return c

def binarysearch2(arr, target):
	lo = 0
	hi = len(arr) - 1
	while lo <= hi:
		mid = (lo + hi) // 2
		if arr[mid] == target:
			if mid != len(arr) - 1:
				if arr[mid + 1] != target:
					return mid
				else:
					lo += 1
			else:
				return mid
			continue
		if arr[mid] > target:
			hi = mid - 1
		else:
			lo = mid + 1

def nge(arr, n):
	stack = []
	ans = []
	for i in range(n - 1, -1, -1):
		if len(stack) == 0:
			ans.append(-1)
		else:
			while len(stack) > 0:
				if stack[-1][0] < arr[i]:
					stack.pop()
				else:
					break
			if len(stack) == 0:
				ans.append(-1)
			else:
				ans.append(stack[-1][1])
		stack.append([arr[i], i])
	ans.reverse()
	return ans

def alperm(nums, path, result):
	if not nums:
		result.add(tuple(path))
		return
	for i in range(0, len(nums)):
		alperm(nums[:i] + nums[i + 1:], path + [nums[i]], result)
	return result

def minsum(arr, n, m, res, l):
	if n == 1 and m == 1:
		res += arr[0][0]
		l.append(res)
	else:
		if n != 1:
			p = res + arr[n - 1][m - 1]
			minsum(arr, n - 1, m, p, l)
		if m != 1:
			p = res + arr[n - 1][m - 1]
			minsum(arr, n, m - 1, p, l)
	return min(l)

def find_shortest_path(graph, start, end, path):
	path = path + [start]
	if start == end:
		return path
	if start not in graph:
		return None
	shortest = None
	for node in graph[start]:
		if node not in path:
			newpath = find_shortest_path(graph, node, end, path)
			if newpath:
				if not shortest or len(newpath) < len(shortest):
					shortest = newpath
	return shortest

def find(arr, i):
	while i != arr[i]:
		i = arr[i]
		arr[i] = arr[arr[i]]
	return i

def union(i, j, parent):
	(u, v) = (find(parent, i), find(parent, j))
	if u != v:
		parent[u] = v

def test(n, d):
	a = random.randint(1, n - 2)
	p = pow(a, d, n)
	if p == 1 or p == n - 1:
		return True
	while d != n - 1:
		d *= 2
		p = pow(p, 2, n)
		if p == n - 1:
			return True
	return False

def isprime(n):
	if n == 1:
		return False
	if n == 2:
		return True
	if n == 3:
		return True
	d = n - 1
	while d % 2 == 0:
		d //= 2
	for i in range(5):
		if test(n, d) == False:
			return False
	return True

def prime(x):
	if x == 1:
		return False
	else:
		for i in range(2, int(math.sqrt(x)) + 1):
			if x % i == 0:
				return False
		else:
			return True

def fun(k, ans, l, n):
	q = ''.join(l)
	if len(q) != 0:
		q = int(q)
		if not isprime(q):
			ans.append(q)
			return
	if n == 0:
		return
	fun(k, ans, l + [k[n - 1]], n - 1)
	fun(k, ans, l, n - 1)

def fun1(k, res, n, c):
	if len(c) != 0:
		res.append(c)
	if n == 0:
		return
	fun1(k, res, n - 1, c + k[n - 1])
	fun1(k, res, n - 1, c)

def main():
	t = inpu()
	for _ in range(t):
		n = inpu()
		k = inp()
		ans = -1
		even = 0
		for i in k:
			if int(i) % 2 == 0 and int(i) != 2 or i in ['1', '4', '9']:
				even += 1
				ans = i
				break
		if even == 1:
			print(1)
			print(ans)
			continue
		ans = -1
		o = 0
		for i in k:
			if k.count(i) > 1 and i != '1':
				ans = i
				o += 1
				break
		if o != 0:
			print(2)
			ans = ans + ans
			print(ans)
		else:
			k = list(k)
			res = []
			k.reverse()
			c = ''
			min1 = 10 ** 18
			ans2 = -1
			fun1(k, res, n, c)
			for i in res:
				p = int(i)
				if prime(p) == False:
					if len(i) < min1:
						min1 = len(i)
						ans2 = p
			print(min1)
			print(ans2)
main()


for i in range(int(input())):
	k = int(input())
	a = list(map(int, input()))
	i = 0
	e = 10 * [0]
	y = 1
	f = [1, 4, 6, 8, 9]
	for j in a:
		if j in f:
			print(1)
			print(j)
			y = 0
			break
		e[j] = e[j] + 1
	if y == 1:
		for j in range(1, len(e)):
			if e[j] >= 2:
				print(2)
				print(j + 10 * j)
				y = 0
				break
	if y == 1:
		if a[1:].count(2):
			print(2)
			print(a[0] * 10 + 2)
		elif a[1:].count(5):
			print(2)
			print(a[0] * 10 + 5)
		elif e[2] > 0 and e[7] > 0:
			print('2\n27')
		elif e[7] > 0 and e[5] > 0:
			print('2\n57')
		else:
			print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	a = ['1', '4', '6', '8', '9']
	for i in s:
		if i in a:
			print(f'1\n{i}')
			break
	else:
		a = ['22', '25', '27', '33', '35', '32', '52', '55', '57', '72', '75', '77']
		if s[0:2] in a:
			print(f'2\n{s[0:2]}')
		elif s[1:3] in a:
			print(f'2\n{s[1:3]}')
		else:
			print(f'2\n{s[0] + s[2]}')


def isp(n):
	if n <= 1:
		return 0
	for i in range(2, int(n ** 0.5) + 1, 1):
		if n % i == 0:
			return 0
	return 1

def calc():
	k = int(input())
	n = list(input())
	p = -1
	for i in range(k):
		if n[i] != '2' and n[i] != '3' and (n[i] != '5') and (n[i] != '7'):
			p = i
			break
	if p != -1:
		print(1)
		print(int(n[p]))
		return
	m = -1
	f = 0
	for i in range(k):
		for j in range(i + 1, k, 1):
			m = (int(n[i]) - 0) * 10 + (int(n[j]) - 0)
			if not isp(m):
				f = 1
				break
		if f:
			break
	print(2)
	print(m)
	return
t = int(input())
for z in range(t):
	calc()


t = int(input())
while t:
	k = int(input())
	s = input()
	comp = [1, 4, 6, 8, 9]
	flag = 0
	comp2 = [22, 25, 27, 35, 72, 77, 52, 32, 55, 75, 33, 57]
	for i in s:
		i = int(i)
		if i in comp:
			flag = 1
			I = str(i)
			print(len(I))
			print(i)
			break
	if flag == 0:
		for i in range(len(s)):
			for j in range(i + 1, len(s)):
				k = s[i] + s[j]
				k = int(k)
				if k in comp2:
					K = str(k)
					print(len(K))
					print(k)
					break
			else:
				continue
			break
	t -= 1


for _ in range(int(input())):
	k = int(input())
	n = input()
	l1 = [1, 4, 6, 8, 9]
	l2 = [25, 27, 32, 33, 22, 35, 52, 55, 57, 72, 75, 77]
	t = 1
	for i in n:
		if int(i) in l1:
			print(1)
			print(i)
			break
	else:
		for i in range(k):
			for j in range(i + 1, k):
				if int(n[i] + n[j]) in l2:
					print(2)
					print(n[i] + n[j])
					t = 0
					break
			if t == 0:
				break


import sys
import os
import math
from io import BytesIO, IOBase
from collections import defaultdict, Counter, deque
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
s1 = set(['1', '4', '6', '8', '9'])
t = int(input())
for i in range(t):
	k = int(input())
	n = input()
	flag = 0
	for j in n:
		if j in s1:
			print(1)
			print(j)
			flag = 1
			break
	if flag:
		continue
	print(2)
	for j in range(1, k):
		if n[j] == '2' or n[j] == '5':
			print(n[j - 1:j + 1])
			break
	else:
		c = Counter(n)
		for j in c:
			if c[j] >= 2:
				print(j * 2)
				break
		else:
			print(n[0] + '7')


t = int(input())
for i in range(t):
	length = input()
	num = input()
	visited = {'2': 0, '3': 0, '5': 0, '7': 0}
	result = ''
	found_2 = False
	found = False
	for digit in num:
		if digit != '2' and digit != '3' and (digit != '5') and (digit != '7'):
			print(1)
			print(digit)
			found = True
			break
		elif not found_2:
			if digit == '3':
				if visited['3'] > 0:
					result = '33'
					found_2 = True
				else:
					visited['3'] += 1
			elif visited['2'] > 0:
				found_2 = True
				result = '2' + digit
			elif visited['5'] > 0:
				found_2 = True
				result = '5' + digit
			elif visited['7'] > 0:
				found_2 = True
				result = '7' + digit
			elif visited['3'] > 0 and digit != '7':
				found_2 = True
				result = '3' + digit
			else:
				visited[digit] += 1
	if not found:
		print(2)
		print(result)


digits = []
digits1 = []
not_simp = {'1', '4', '6', '8', '9'}
simp = {'11', '13', '17', '19', '23', '29', '31', '37', '53', '59', '71', '73', '79', '97'}
n = int(input())
for i in range(n):
	m = int(input())
	digits.append(int(input()))
for k in digits:
	f = 1
	str_k = str(k)
	for s in str_k:
		if s in not_simp:
			print(1)
			print(s)
			f = 0
			break
	if f:
		i = 0
		tmp = ''
		while i < len(str_k) - 1:
			j = i + 1
			while j < len(str_k):
				tmp = str_k[i] + str_k[j]
				if tmp not in simp:
					print(2)
					print(tmp)
					j = 50
					i = 50
				j += 1
			i += 1


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input()]
	found = False
	for i in range(len(l)):
		if l[i] % 2 == 0 and l[i] != 2:
			print(1)
			print(l[i])
			found = True
			break
		elif l[i] == 1:
			print(1)
			print(1)
			found = True
			break
	if found:
		continue
	ll = [3]
	for i in range(len(l)):
		for k in ll:
			if l[i] % k == 0 and l[i] != k:
				print(1)
				print(l[i])
				found = True
				break
		if found:
			break
	if found:
		continue
	ll = [2, 3, 5, 7]
	for i in range(len(l)):
		for j in range(i + 1, len(l)):
			for k in ll:
				if int(str(l[i]) + str(l[j])) % k == 0:
					print(2)
					print(int(str(l[i]) + str(l[j])))
					found = True
					break
			if found:
				break
		if found:
			break


def solve(n: str):
	data = {'2', '3', '5', '7'}
	for i in n:
		if i not in data:
			print(1)
			print(i)
			return
	data = {'53', '37', '73', '23'}
	temp = set()
	for i in n:
		for j in temp:
			if j + i not in data:
				print(2)
				print(j + i)
				return
		temp.add(i)
for i in range(int(input())):
	n = int(input())
	n = input()
	solve(n)


def solution():
	l = int(input())
	n = input()
	ar = []
	ck = [1, 4, 6, 8, 9]
	ar = [int(0) for i in range(60)]
	cnt = int(0)
	for i in n:
		if int(i) in ck:
			print('1')
			print(i)
			return
	for i in n:
		ar[int(i)] += 1
		if ar[int(i)] > 1:
			print(2)
			print(i + i)
			return
		elif int(i) == 2 or int(i) == 5:
			if cnt > 0:
				print(2)
				print(n[0] + i)
				return
		elif int(i) == 7:
			if ar[5] > 0:
				print(2)
				print(57)
				return
			elif ar[2] > 0:
				print(2)
				print(27)
				return
		cnt += 1
t = int(input())
while t > 0:
	t -= 1
	solution()


import sys
n = int(input())
s1 = {'1', '4', '6', '8', '9'}
pre = {'5': ['2', '3', '7'], '2': ['3', '5', '7'], '7': ['2', '5'], '3': []}
for _ in range(n):
	(k, s) = (int(input()), input())
	find = False
	d = {'2': 0, '3': 0, '5': 0, '7': 0}
	for c in s:
		if c in s1:
			find = True
			print(1)
			print(c)
			break
		else:
			d[c] += 1
	if find:
		continue
	for (c, v) in d.items():
		if v >= 2:
			print(2)
			print(c * 2)
			find = True
			break
	if find:
		continue
	t = set()
	for c in s:
		for pre_c in pre[c]:
			if pre_c in t:
				find = True
				print(2)
				print(pre_c + c)
				break
		if find:
			break
		t.add(c)


is_prime = [True for i in range(205)]
is_prime[0] = False
is_prime[1] = False
i = 2
while i * i <= 205:
	if is_prime[i]:
		for j in range(i + i, 205, i):
			is_prime[j] = False
	i += 1

def solve(n, s):
	idx = -1
	for i in range(n):
		if s[i] == '1' or s[i] == '4' or s[i] == '6' or (s[i] == '8') or (s[i] == '9'):
			print(1)
			print(s[i])
			return
	for i in range(n):
		aux = []
		aux.append(s[i])
		for j in range(i + 1, n):
			aux.append(s[j])
			if not is_prime[int(''.join(aux))]:
				print(2)
				print(''.join(aux))
				return
			aux.pop()
t = int(input())
for i in range(t):
	n = int(input())
	no = input()
	solve(n, no)


t = int(input())
while t > 0:
	k = int(input())
	s = input()
	kt = True
	mp = {}
	for i in range(len(s)):
		if int(s[i]) == 1:
			print(1)
			print(1)
			kt = False
			break
		if int(s[i]) % 2 == 0 and s[i] != '2':
			print(1)
			print(s[i])
			kt = False
			break
		if int(s[i]) % 3 == 0 and s[i] != '3':
			print(1)
			print(s[i])
			kt = False
			break
	if kt == True:
		for i in range(len(s)):
			if s[i] == '2' and i != 0:
				print(2)
				print(s[i - 1:i + 1])
				kt = False
				break
			if s[i] == '5' and i != 0:
				print(2)
				print(s[i - 1:i + 1])
				kt = False
				break
			if s[i] not in mp:
				mp[s[i]] = 1
			else:
				print(2)
				print(s[i] + s[i])
				kt = False
				break
	if kt == True:
		if '1' in s:
			if '2' in s:
				print(2)
				print(21)
			elif '5' in s:
				print(2)
				print(51)
		elif '7' in s:
			if '2' in s:
				print(2)
				print(27)
			elif '5' in s:
				print(2)
				print(57)
	t -= 1


prime = [2, 3, 5, 7]
possible = {2: [2, 5, 7], 3: [2, 3, 5], 5: [2, 5, 7], 7: [2, 5, 7]}
n = int(input())
for _ in range(n):
	unprimes = []
	k = int(input())
	nums = list(map(int, list(input())))
	for x in nums:
		if x not in prime:
			print(1)
			print(x)
			break
		else:
			unprimes.append(x)
	else:
		print(2)
		for i in range(k - 1):
			flag = 0
			for x in unprimes[i + 1:]:
				if x in possible[unprimes[i]]:
					print(str(unprimes[i]) + str(x))
					flag = 1
					break
			if flag:
				break


def eratosthenes(n):
	sieve = list(range(n + 1))
	sieve[1] = 0
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	sieve1 = set(sieve)
	return sieve1
sieve1 = eratosthenes(100)
t = int(input())
for w in range(t):
	n = int(input())
	string = input()
	find = False
	for lett in string:
		if int(lett) not in sieve1:
			print(1)
			print(int(lett))
			find = True
			break
	if not find:
		for i in range(n - 1):
			if not find:
				for j in range(i + 1, n):
					if int(string[i] + string[j]) not in sieve1:
						print(2)
						print(int(string[i] + string[j]))
						find = True
						break
			else:
				break


import sys, os
from math import sqrt, gcd, ceil, factorial
from collections import defaultdict
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
from itertools import combinations

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
for _ in range(int(input())):
	k = int(input())
	num = input()
	f = 0
	for i in num:
		if i == '1':
			print(1)
			print(1)
			f = 1
			break
		elif not isprime(int(i)):
			print(1)
			print(i)
			f = 1
			break
	if f == 1:
		continue
	f = 0
	for i in range(k - 1):
		for j in range(i + 1, k):
			if not isprime(int(num[i]) * 10 + int(num[j])):
				print(2)
				print(num[i] + num[j])
				f = 1
				break
		if f:
			break


a = int(input())
for i in range(a):
	k = input()
	n = input()
	flag = 0
	for j in range(len(n)):
		if int(n[j]) != 2 and int(n[j]) != 3 and (int(n[j]) != 5) and (int(n[j]) != 7):
			flag = 1
			print(1)
			print(n[j])
			break
	if flag == 0:
		for j in range(len(n) - 1):
			if flag == 1:
				break
			for z in range(j + 1, len(n)):
				if flag == 1:
					break
				x = int(n[j] + n[z])
				for l in range(2, int(x ** 0.5) + 2):
					if x % l == 0:
						print(2)
						print(x)
						flag = 1
						break


p = int(input())
for _ in range(p):

	def comp(x):
		for y in range(2, int(x ** 0.5) + 1):
			if x % y == 0:
				return True
		return False
	k = int(input())
	x = input()
	what = {'1', '4', '6', '8', '9'}
	stone = ''
	f = set()
	for a in x:
		if a in what:
			print('1')
			print(a)
			break
		if len(stone) == 0:
			for g in f:
				if comp(int(g + a)):
					stone = g + a
			f.add(a)
	else:
		print('2')
		print(stone)


from math import sqrt

def isprime(n):
	prime_flag = 0
	if n > 1:
		for i in range(2, int(sqrt(n)) + 1):
			if n % i == 0:
				prime_flag = 1
				break
		if prime_flag == 0:
			return True
		else:
			return False
	else:
		return False
for t in range(int(input())):
	a = int(input())
	b = input()
	q = 0
	o = 0
	x = 0
	for m in b:
		c = int(m)
		if not isprime(c):
			print(1)
			print(c)
			x += 1
			break
	if x == 1:
		continue
	for r in b:
		q += 1
		for mm in range(q, a):
			tt = r + b[mm]
			v = int(tt)
			if not isprime(v):
				print(2)
				print(v)
				o += 1
				break
		if o == 1:
			break


from sys import stdin, stdout
input = stdin.readline

def isPrime(n):
	if n <= 1:
		return False
	for i in range(2, n):
		if n % i == 0:
			return False
	return True

def f():
	for i in range(n):
		for j in range(i + 1, n):
			if not isPrime(int(s[i] + s[j])):
				print(2)
				print(int(s[i] + s[j]))
				return
t = int(input())
for _ in range(t):
	n = int(input())
	s = input().strip()
	for i in s:
		if not isPrime(int(i)):
			print(1)
			print(i)
			break
	else:
		f()


from itertools import combinations
import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	n = int(input())
	s = input().rstrip()
	flg = False
	for t in s:
		if int(t) not in [2, 3, 5, 7]:
			print(1)
			print(t)
			flg = True
			break
	if not flg:
		if n == 1 or n == 2:
			print(n)
			print(s)
		elif n >= 3:
			for t in combinations(list(s), 2):
				if int(''.join(t)) not in [23, 37, 53, 73]:
					print(2)
					print(''.join(t))
					break


primes = ['2', '3', '5', '7']
T = int(input())

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m
for t in range(T):
	k = int(input())
	n = str(input())
	found = False
	for i in range(k):
		if n[i] not in primes:
			print(1)
			print(n[i])
			found = True
			break
	ss = ['22', '25', '27', '32', '33', '35', '52', '55', '57', '72', '75', '77']
	if found is False:
		for i in ss:
			if isSubSequence(i, n):
				print(2)
				print(i)
				found = True
				break


from collections import Counter
import string
import math
import bisect
import sys
from fractions import Fraction

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m
testcases = vary(1)
for _ in range(testcases):
	primes = [1, 4, 6, 8, 9]
	nt = int(input())
	n = input()
	for i in n:
		if int(i) in primes:
			print(1)
			print(i)
			break
	else:
		st = ['25', '27', '35', '52', '57', '72', '75', '77', '33', '22', '55', '32']
		for i in st:
			if isSubSequence(i, n):
				print(2)
				print(i)
				break


import math
t = int(input())
for z in range(t):
	prime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
	a = int(input())
	b = input()
	ans = -1
	val = -1
	for i in range(a):
		if b[i] == '1' or b[i] == '4' or b[i] == '6' or (b[i] == '8') or (b[i] == '9'):
			ans = 1
			val = b[i]
			break
	if ans != 1:
		for i in range(a):
			for j in range(i + 1, a):
				if prime.count(int(b[i]) * 10 + int(b[j])) == 0:
					ans = 2
					val = int(b[i]) * 10 + int(b[j])
					break
	print(ans)
	print(val)


def solve(n):
	x = set(['1', '4', '6', '8', '9'])
	x_3 = set(['3', '6'])
	x_7 = set(['2', '5', '7', '8'])
	nn = len(n)
	for i in n:
		if i in x:
			return i
	i_5 = n.find('5', 1, nn)
	if i_5 > 0:
		return n[i_5 - 1] + n[i_5]
	i_2 = n.find('2', 1, nn)
	if i_2 > 0:
		return n[i_2 - 1] + n[i_2]
	i_3 = n.find('3')
	for i in n[:i_3]:
		if i in x_3:
			return i + '3'
	if i_3 != -1 and i_3 < len(n):
		for i in n[i_3 + 1:]:
			if i == '3':
				return '33'
	i_7 = n.find('7')
	for i in n[:i_7]:
		if i in x_7:
			return i + '7'
	if i_7 != -1 and i_7 < len(n):
		for i in n[i_7:]:
			if i == '7':
				return '77'
for _ in range(int(input())):
	k = int(input())
	n = input()
	ans = solve(n)
	print(len(ans))
	print(ans)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	k = int(input())
	n = str(int(input()))
	digits = [i for i in n]
	primes = ['2', '3', '5', '7']
	prime_counts = {'2': 0, '3': 0, '5': 0, '7': 0}
	end = 0
	for i in digits:
		if i not in primes:
			print(1)
			print(i)
			end = 1
			break
		else:
			prime_counts[i] += 1
	if end:
		continue
	for i in prime_counts:
		if prime_counts[i] >= 2:
			print(2)
			print(i * 2)
			end = 1
			break
	if end:
		continue
	if '5' in digits and '2' in digits:
		if digits.index('2') < digits.index('5'):
			print(2)
			print('25')
			continue
		else:
			print(2)
			print('52')
			continue
	if len(digits) == 2:
		print(2)
		print(n)
		continue
	c1 = digits[0] + digits[2]
	c2 = digits[0] + digits[1]
	c3 = digits[1] + digits[2]
	rprimes = [11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
	for i in (c1, c2, c3):
		if int(i) not in rprimes:
			print(2)
			print(i)
			break


def prime(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True
for _ in range(int(input())):
	k = int(input())
	s = input()
	t = {'4', '6', '8', '9', '1'}
	flg = 0
	for i in s:
		if i in t:
			flg = 1
			print(1)
			print(i)
			break
	if flg == 1:
		continue
	for i in range(k):
		for j in range(i + 1, k):
			if not prime(int(s[i] + s[j])):
				print(2)
				print(s[i] + s[j])
				flg = 1
				break
		if flg == 1:
			break
	if flg == 0:
		print(k)
		print(s)


q = {'1', '4', '6', '8', '9'}
for i in range(int(input())):
	n = int(input())
	s = input()
	for i in s:
		if i in q:
			print(1)
			print(i)
			break
	else:
		print(2)
		z = {*s}
		l = {}
		k = {23, 53, 37, 73}
		for i in z:
			l[i] = s.count(i)
		for i in l:
			if l[i] > 1:
				print(i * 2)
				break
		else:
			t = 1
			for i in s:
				if t:
					for j in s:
						if i != j and int(i + j) not in k:
							print(i + j)
							t = 0
							break


def solve():
	total_num = int(input())
	number = int(input())
	arr = []
	primes = [2, 3, 5, 7]
	while number > 0:
		arr.append(number % 10)
		number = number // 10
	arr.reverse()
	for i in arr:
		if i not in primes:
			return [1, i]
	for i in range(total_num):
		if arr[i] == 2:
			for j in range(i + 1, total_num):
				if arr[j] == 5 or arr[j] == 2 or arr[j] == 7:
					return [2, arr[i] * 10 + arr[j]]
		elif arr[i] == 3:
			for j in range(i + 1, total_num):
				if arr[j] == 5 or arr[j] == 2 or arr[j] == 3:
					return [2, arr[i] * 10 + arr[j]]
		elif arr[i] == 5:
			for j in range(i + 1, total_num):
				if arr[j] == 5 or arr[j] == 2 or arr[j] == 7:
					return [2, arr[i] * 10 + arr[j]]
		elif arr[i] == 7:
			for j in range(i + 1, total_num):
				if arr[j] == 5 or arr[j] == 2 or arr[j] == 7:
					return [2, arr[i] * 10 + arr[j]]
remained_test_cases = 1
remained_test_cases = int(input())
while remained_test_cases > 0:
	output = solve()
	print(output[0])
	print(output[1])
	remained_test_cases -= 1


import math, io, os, sys
from itertools import combinations

def find_ans(n, k):
	for i in range(1, k + 1):
		for comb in combinations(n, i):
			q = int(''.join(comb))
			if not all((q % j for j in range(2, q))) or q == 1:
				print(len(str(q)))
				print(q)
				return
t = int(input())
for _ in range(t):
	k = int(input())
	n = input()
	find_ans(n, k)


prime = [2, 3, 5, 7]
not_prime = [1, 4, 6, 8, 9]
not_prime2 = [22, 25, 27, 32, 33, 35, 52, 55, 57, 72, 75, 77]
t = int(input())
for __ in range(t):
	n = int(input())
	num = input()
	if len(num) == 1:
		print(1)
		print(num)
	else:
		ans = 0
		for i in range(n):
			if int(num[i]) in not_prime:
				ans = int(num[i])
				break
		if ans != 0:
			print(1)
			print(ans)
		else:
			for i in range(1, n):
				ans1 = int(num[0] + num[i])
				if i != n - 1:
					ans2 = int(num[1] + num[i + 1])
				if ans1 in not_prime2:
					print(2)
					print(ans1)
					break
				elif ans2 in not_prime2:
					print(2)
					print(ans2)
					break


from math import sqrt
from itertools import count, islice

def is_prime(n):
	if n < 2:
		return False
	for number in islice(count(2), int(sqrt(n) - 1)):
		if n % number == 0:
			return False
	return True

def game():
	n = int(input())
	num = input()
	ans = ''
	for i in num:
		if i == '1' or i == '4' or i == '6' or (i == '8') or (i == '9'):
			print('1')
			print(i)
			return
	for i in range(len(num) - 1):
		for j in range(i + 1, len(num)):
			ans = num[i] + num[j]
			if is_prime(int(ans)) == False:
				print(len(ans))
				print(ans)
				return
	return
t = int(input())
while t:
	game()
	t -= 1


def checkPairs(numDig, dig):
	for i in range(numDig - 1):
		for j in range(i + 1, numDig):
			if dig[i] == dig[j]:
				print(2)
				print(dig[i] * 2)
				return True
	return False

def solve(numDig, dig):
	for i in range(numDig):
		if dig[i] in ['1', '4', '6', '8', '9']:
			print(1)
			print(dig[i])
			return
	if numDig == 2:
		print(2)
		print(''.join(dig))
	elif checkPairs(numDig, dig):
		return
	else:
		print(2)
		while len(dig) != 2:
			try:
				dig.remove('3')
			except:
				dig.remove('7')
		print(''.join(dig))
tcs = int(input())
for i in range(tcs):
	numDig = int(input())
	dig = list(map(str, input()))
	solve(numDig, dig)


prime = ['2', '3', '5', '7']
for _ in range(int(input())):
	k = int(input())
	n = input()
	c = 0
	for i in n:
		if not i in prime:
			print('1')
			print(int(i))
			c = 1
			break
	if c == 0:
		for i in range(k - 1):
			if c == 0:
				for j in range(i + 1, k):
					if c == 0:
						for z in range(2, 10):
							if int(n[i] + n[j]) % z == 0:
								print('2')
								print(n[i] + n[j])
								c = 1
								break


prim = ['1', '4', '6', '8', '9', '22', '25', '27', '32', '33', '35', '52', '55', '57', '72', '75', '77']

def calc(x, b):
	v = []
	for e in x:
		if e in prim[:5]:
			return e
	if x in prim:
		return x
	x = x[:3]
	if x[0] + x[1] in prim:
		v.append(x[0] + x[1])
	if x[0] + x[2] in prim:
		v.append(x[0] + x[2])
	if x[1] + x[2] in prim:
		v.append(x[1] + x[2])
	return min(v)
for _ in range(int(input())):
	b = int(input())
	x = input()
	v = calc(x, b)
	print(str(len(v)) + '\n' + str(v))


for inp in range(int(input())):
	a1 = int(input())
	inp1 = input()
	a3 = int(inp1)
	find = True
	len_x = ['4', '6', '8', '9', '1']
	len = ['27', '52', '32', '57', '77', '33', '22', '35', '55', '75', '72', '25']
	for i in len_x:
		if i in inp1:
			find = False
			print(1)
			print(i)
			break
	if find:
		for i in len:
			xx1 = inp1.find(i[0])
			if xx1 != -1:
				if i[1] in inp1[xx1 + 1:]:
					print(2)
					print(i)
					break


def func(p):
	for i in range(2, 10):
		if p % i == 0:
			return True
	return False
a = int(input())
for b in range(a):
	x = int(input())
	y = input()
	f = 0
	for i in range(x):
		if int(y[i]) % 2 == 0 and int(y[i]) != 2 or (int(y[i]) % 3 == 0 and int(y[i]) != 3) or int(y[i]) == 1:
			print(1)
			print(y[i])
			f = 1
			break
	if f == 0:
		for i in range(x - 1):
			for j in range(i + 1, x):
				if func(int(y[i] + y[j])):
					print(2)
					print(y[i] + y[j])
					f = 1
					break
			if f == 1:
				break


def prime(n):
	if n == 0:
		return True
	if n == 2:
		return True
	for i in range(2, n):
		if n % i == 0:
			return False
	return True
n = int(input())
while n > 0:
	l = int(input())
	main = input()
	num = int(main)
	t = 1
	i = 1
	f = False
	tp = ''
	for u in range(len(main)):
		if not prime(int(main[u])) or main[u] == '1':
			f = True
			tp = main[u]
			break
	if f:
		print(1)
		print(tp)
	else:
		for j in range(1, l + 1):
			flag = False
			sn = main[:j]
			for k in range(1, int(sn) + 1):
				sx = str(k)
				p1 = 0
				p2 = 0
				ssn = ''
				taken = 0
				for z in range(len(sn)):
					if p2 == len(sx) or p1 == len(sn):
						break
					if sx[p2] == sn[p1]:
						ssn += sn[p1]
						p1 += 1
						p2 += 1
						taken += 1
					else:
						p1 += 1
				if ssn == '':
					ssn = 0
				if ssn == '1':
					flag = True
					break
				if not prime(int(ssn)):
					flag = True
					break
			if flag:
				print(taken)
				print(ssn)
				break
	n -= 1


t = int(input())
notPrimes = [1, 4, 6, 8, 9]
Di = {2: 3, 3: 7, 7: 3, 5: 3}
while t > 0:
	ok = True
	t -= 1
	xxx = int(input())
	s = input().split()[0]
	arr = [0] * 10
	for x in s:
		id = ord(x) - ord('0')
		arr[id] += 1
		if id in notPrimes:
			ok = False
			break
	if not ok:
		print(1)
		for x in notPrimes:
			if arr[x] != 0:
				print(x)
				break
	else:
		print(2)
		ans = ''
		for x in s:
			id = ord(x) - ord('0')
			if arr[id] >= 2:
				ans = x + x
				break
			found = -1
			for i in range(10):
				if i != id and i != Di[id] and (arr[i] > 0):
					found = i
					break
			if found != -1:
				ans = x + str(found)
			arr[id] -= 1
		print(ans)


t = int(input())
for _ in range(t):
	k = int(input())
	n = input()
	mem = {'2': False, '3': False, '5': False, '7': False}
	(an1, an2) = (0, '')
	for d in n:
		if d in '14689':
			an1 = 1
			an2 = d
			break
		if (mem['2'] or mem['5'] or mem['7']) and d in '257':
			an1 = 2
			if mem['2']:
				an2 = '2' + d
			if mem['5']:
				an2 = '5' + d
			if mem['7']:
				an2 = '7' + d
		if mem['3'] and d in '235':
			an1 = 2
			an2 = '3' + d
		if d in '2357':
			mem[d] = True
	print(an1)
	print(an2)


for _ in range(int(input())):
	k = int(input())
	num = input()
	comp = set([1, 4, 6, 8, 9])
	f = 0
	count = [0] * 10
	for i in num:
		count[int(i)] += 1
		if int(i) in comp:
			f = 1
			print(1)
			print(int(i))
			break
	if f == 0 and count[2] >= 1:
		if num[0] != '2':
			print(2)
			print(int(num[0]) * 10 + 2)
			f = 1
		elif count[5] >= 1:
			print(2)
			print(25)
			f = 1
		elif count[7] >= 1:
			print(2)
			print(27)
			f = 1
		elif count[2] >= 2:
			print(2)
			print(22)
			f = 1
	if count[5] >= 1 and f == 0:
		if num[0] != '5':
			print(2)
			print(int(num[0]) * 10 + 5)
			f = 1
		elif count[7] != 0:
			print(2)
			print(57)
			f = 1
		elif count[5] >= 2:
			print(2)
			print(55)
			f = 1
	if count[3] >= 2 and f == 0:
		print(2)
		print(33)
		f = 1
	if count[7] >= 2 and f == 0:
		print(2)
		print(77)


t = int(input())
for _ in range(t):
	k = int(input())
	n = input()
	found = -1
	for i in range(k):
		if n[i] == '1' or n[i] == '4' or n[i] == '6' or (n[i] == '8') or (n[i] == '9'):
			found = i
			break
	if found > -1:
		print(1)
		print(n[found])
	else:
		flag = 0
		occur = {}
		for i in range(k):
			if n[i] in occur:
				occur[n[i]] += 1
				flag = 1
				print(2)
				print(n[i] * 2)
				break
			else:
				occur[n[i]] = 1
		if flag == 0:
			if n[0] == '2':
				if '5' in occur:
					print(2)
					print(25)
				else:
					print(2)
					print(27)
			elif '2' in occur:
				print(2)
				print(n[0] + '2')
			elif n[0] == '5':
				print(2)
				print(57)
			elif '5' in occur:
				print(2)
				print(n[0] + '5')
			else:
				print('sike')


import os, sys
input = lambda : sys.stdin.buffer.readline().rstrip(b'\r\n')

def dbp(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)
a_str = lambda : input().decode('ascii')
get_int_list = lambda : [int(x) for x in input().split()]
join_str = lambda l, ch=' ': ch.join((str(x) for x in l))
maxf = 10 ** 5 + 1
sieve = [i for i in range(maxf)]
for i in range(2, maxf):
	if sieve[i] == i:
		for j in range(i * i, maxf, i):
			sieve[j] = i
sieve[1] = 0

def do_thing():
	k = int(input())
	ns = a_str()
	ans = 'x' * (k + 1)
	for d1 in range(k):
		n = int(ns[d1])
		if sieve[n] != n:
			if 1 < len(ans):
				ans = ns[d1]
		for d2 in range(d1 + 1, k):
			sub = ns[d1] + ns[d2]
			n = int(sub)
			if sieve[n] != n:
				if 2 < len(ans):
					ans = sub
			for d3 in range(d2 + 1, k):
				sub = ns[d1] + ns[d2] + ns[d3]
				n = int(sub)
				if sieve[n] != n:
					if 3 < len(ans):
						ans = sub
	return str(len(ans)) + '\n' + ans
maxcc = 1
maxcc = int(input())
for cc in range(maxcc):
	print(do_thing())


t = int(input())
for _ in range(t):
	k = int(input())
	n = input()
	req_list = ['22', '25', '27', '33', '32', '35', '55', '52', '57', '77', '72', '75']
	ans = False
	if len(n) == 1:
		print(1)
		print(n)
		continue
	for i in range(k):
		if n[i] == '1' or n[i] == '4' or n[i] == '6' or (n[i] == '8') or (n[i] == '9'):
			print(1)
			print(n[i])
			ans = True
			break
	if ans == False:
		for i in range(k):
			for j in range(i + 1, k):
				if n[i] + n[j] in req_list:
					print(2)
					print(n[i] + n[j])
					ans = True
					break
			if ans == True:
				break


PRIME_DIGITS = {2, 3, 5, 7}
TWO_DIGIT_PRIMES = {11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97}

def main():
	n = int(input())
	for _ in range(n):
		k = int(input())
		num = [int(digit_str) for digit_str in input()]
		solve(k, num)

def solve(k, num):
	for digit in num:
		if digit not in PRIME_DIGITS:
			print('1')
			print(digit)
			return
	for i in range(len(num)):
		for j in range(i + 1, len(num)):
			if num[i] * 10 + num[j] not in TWO_DIGIT_PRIMES:
				print('2')
				print(num[i] * 10 + num[j])
				return
main()


def isPrime(num):
	flag = True
	if num > 1:
		for i in range(2, num):
			if num % i == 0:
				flag = False
				break
	return flag
n = int(input())
res = []
for i in range(n):
	l = int(input())
	num = input()
	if '1' in num or '4' in num or '6' in num or ('8' in num) or ('9' in num):
		for i in range(l):
			if num[i] == '1' or num[i] == '4' or num[i] == '6' or (num[i] == '8') or (num[i] == '9'):
				res.append(1)
				res.append(int(num[i]))
				break
	else:
		fl = False
		for i in range(len(num)):
			if fl != True:
				for j in range(len(num)):
					if fl != True:
						if i != j and i < j:
							if isPrime(int(num[i] + num[j])) == False:
								res.append(len(num[i] + num[j]))
								res.append(int(num[i] + num[j]))
								fl = True
					else:
						break
			else:
				break
print(*res, sep='\n')


t = int(input())
prime2 = []
for i in range(2, 1000):
	prime = True
	for j in prime2:
		if i % j == 0:
			prime = False
			break
	if prime:
		prime2.append(i)

def digits(i, k, s, out, n):
	if len(out) > 0:
		test = int(out)
		for prime in prime2:
			if prime == test:
				break
			if prime > test:
				return out
	if n == 0:
		return ''
	for j in range(i + 1, k):
		outt = digits(j, k, s, out + s[j], n - 1)
		if outt != '':
			return outt
	return ''
for i in range(t):
	k = int(input())
	s = input()
	for i in range(1, k + 1):
		out = digits(-1, k, s, '', i)
		if out != '':
			print(len(out))
			print(out)
			break


def solve(cnt, num):
	prime = [2, 3, 5, 7]
	for digit in num:
		if digit not in prime:
			print(1, digit, sep='\n')
			return
	prime_2 = [23, 37, 53, 73]
	for a in prime:
		for b in prime:
			if a * 10 + b in prime_2:
				continue
			if a in num and b in num[num.index(a) + 1:] and (num.index(b, num.index(a) + 1) > num.index(a)):
				print(2, f'{a}{b}', sep='\n')
				return
	print('Kke')
queue = []
for _ in range(int(input())):
	queue.append((int(input()), list(map(int, list(input())))))
for el in queue:
	solve(*el)


for t in range(int(input())):
	k = int(input())
	s = input()
	s2 = int(s)
	f = True
	lx = ['4', '6', '8', '9', '1']
	l = ['15', '27', '51', '52', '32', '12', '21', '57', '77', '33', '22', '35', '55', '75', '72', '25']
	for i in lx:
		if i in s:
			f = False
			print(1)
			print(i)
			break
	if f:
		for i in l:
			xx1 = s.find(i[0])
			if xx1 != -1:
				if i[1] in s[xx1 + 1:]:
					print(2)
					print(i)
					break


def prime(n):
	if n == 1:
		return False
	elif n == 2:
		return True
	else:
		for i in range(2, int(n ** 0.5) + 1):
			if n % i == 0:
				return False
		return True
d = {}
for _ in range(int(input())):
	n = int(input())
	s = list(input())
	flag = 0
	d = {int(i): 0 for i in range(1, 10)}
	dind = {}
	c = 0
	for i in s:
		d[int(i)] += 1
		dind[c] = i
		if not prime(int(i)):
			print(1)
			print(i)
			flag = 1
			break
		c += 1
	if flag == 0:
		if d[2] > 1:
			print(2)
			print(22)
		elif d[5] > 1:
			print(2)
			print(55)
		elif d[7] > 1:
			print(2)
			print(77)
		elif d[3] > 1:
			print(2)
			print(33)
		else:
			l = sorted(dind)
			print(2)
			lt = len(l)
			fl = 0
			for i in range(lt - 1):
				for j in range(i + 1, lt):
					if not prime(int(dind[l[i]] + dind[l[j]])):
						print(int(dind[l[i]] + dind[l[j]]))
						fl = 1
						break
				if fl == 1:
					break


from itertools import combinations
import sys
input = sys.stdin.readline

def getInt():
	return int(input())

def getVars():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))

def getStr():
	return input().strip()

def is_prime(m):
	if m > 1:
		for i in range(2, int(m / 2) + 1):
			if m % i == 0:
				return False
		else:
			return True
	else:
		return False
t = getInt()
for _ in range(t):
	m = getInt()
	s = getStr()
	n = len(s)
	ans = []
	ok = False
	for i in range(n):
		if int(s[i]) in [1, 4, 6, 8, 9]:
			print(1)
			print(s[i])
			ok = True
			break
	if ok == True:
		continue
	base = list(combinations(s, 2))
	for c in base:
		m = int(c[0]) * 10 + int(c[1])
		if is_prime(m) == False:
			print(2)
			print(m)
			break


def solve(n, arr):
	order = []
	rem = None
	num = 2
	for x in range(n):
		if arr[x] in order:
			rem = arr[x] * 2
			num = 2
		elif arr[x] == '3':
			order.append(arr[x])
		elif arr[x] == '7':
			if '2' in order:
				rem = '27'
			elif '5' in order:
				rem = '57'
			order.append(arr[x])
		elif arr[x] == '2' or arr[x] == '5':
			if order:
				rem = order[0] + arr[x]
			order.append(arr[x])
		else:
			print(1)
			print(arr[x])
			return
	print(num)
	print(rem)
for _ in range(int(input())):
	solve(int(input()), input())


import sys
import math
import random
from queue import PriorityQueue as PQ
from bisect import bisect_left as BSL
from bisect import bisect_right as BSR
from collections import OrderedDict as OD
from collections import Counter
from itertools import permutations
from decimal import Decimal as BIGFLOAT
mod = 1000000007
sys.setrecursionlimit(1000000)
try:
	sys.stdin = open('actext.txt', 'r')
	OPENFILE = 1
except:
	pass

def get_ints():
	return map(int, input().split())

def palindrome(s):
	mid = len(s) // 2
	for i in range(mid):
		if s[i] != s[len(s) - i - 1]:
			return False
	return True

def check(i, n):
	if 0 <= i < n:
		return True
	else:
		return False

def isPrime(n):
	if n <= 1:
		return False
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def bruteforce(n, ki):
	for i in range(ki):
		ss = int(n[i])
		if not isPrime(ss):
			print(1)
			print(ss)
			return
	for i in range(ki):
		for j in range(i + 1, ki):
			ss = int(n[i] + n[j])
			if not isPrime(ss):
				print(2)
				print(ss)
				return
	if ki >= 3:
		print(3)
		print(n[:3])
		return
	else:
		print(ki)
		print(n)

def solve(n, ki):
	mp = {2: 0, 3: 0, 5: 0, 7: 0}
	sint = []
	for i in n:
		if int(i) == 1:
			print(1)
			print(1)
			return
		elif int(i) == 9:
			print(1)
			print(9)
		elif int(i) % 2 != 0 or int(i) == 2:
			if mp[int(i)] == 0:
				sint.append(i)
			mp[int(i)] += 1
		else:
			print(1)
			print(i)
			return
	for (i, j) in mp.items():
		if j >= 2:
			print(2)
			print(i * 10 + i)
			return
	nn = len(sint)
	for i in range(nn):
		for j in range(i + 1, nn):
			ii = sint[i]
			jj = sint[j]
			ss = int(ii + jj)
			if not isPrime(ss):
				print(2)
				print(ss)
				return
	ans = ''.join(sint)[:3]
	if nn >= 3:
		print(3)
		print(ans)
	else:
		print(ki)
		print(n)
t = int(input())
for tt in range(t):
	k = int(input())
	n = input()
	bruteforce(n, k)


try:
	import sys
	from functools import lru_cache, cmp_to_key
	from heapq import merge, heapify, heappop, heappush
	from math import *
	from collections import defaultdict as dd, deque, Counter as C
	from itertools import combinations as comb, permutations as perm
	from bisect import bisect_left as bl, bisect_right as br, bisect, insort
	from time import perf_counter
	from fractions import Fraction
	import copy
	from copy import deepcopy
	import time
	starttime = time.time()
	mod = int(pow(10, 9) + 7)
	mod2 = 998244353

	def data():
		return sys.stdin.readline().strip()

	def out(*var, end='\n'):
		sys.stdout.write(' '.join(map(str, var)) + end)

	def L():
		return list(sp())

	def sl():
		return list(ssp())

	def sp():
		return map(int, data().split())

	def ssp():
		return map(str, data().split())

	def l1d(n, val=0):
		return [val for i in range(n)]

	def l2d(n, m, val=0):
		return [l1d(n, val) for j in range(m)]
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
p = []
prime = [1 for i in range(1000)]
for i in range(2, 1000):
	if prime[i] == 0:
		continue
	p.append(i)
	for j in range(i, 1000, i):
		prime[j] = 0
for _ in range(L()[0]):
	k = L()[0]
	A = input()
	A = '00' + A
	for i in range(k + 2):
		for j in range(i + 1, k + 2):
			for x in range(j + 1, k + 2):
				if int(A[i] + A[j] + A[x]) not in p:
					print(3 - int(i == 0) - int(j == 1))
					print(int(A[i] + A[j] + A[x]))
					break
			else:
				continue
			break
		else:
			continue
		break


def notprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return True
	return False
for tt in range(int(input())):
	x = int(input())
	l = list(input())
	z = list(dict.fromkeys(l))
	a = 0
	for i in z:
		if i in '14689':
			print(1)
			print(i)
			a = 1
			break
	if a == 1:
		continue
	l = l[:3]
	y = [int(l[i] + l[j]) for i in range(len(l)) for j in range(len(l)) if j > i]
	for i in y:
		if notprime(i):
			print(2)
			print(i)
			break


u = set()

def Sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			u.add(p)
Sieve(10000)
from itertools import combinations as C

def solve():
	a = 0
	n = int(input())
	a += 1
	l = list(input())
	a += 1
	s = ''
	e = 0
	a += 1
	for i in range(1, n + 1):
		for j in C(l, i):
			if int(''.join(j)) not in u:
				s = ''.join(j)
				e = 1
				break
		if e == 1:
			break
	print(len(s))
	a += 1
	a += 1
	a += 1
	print(s)
	a += 1
	a += 1
	a += 1
t = int(input())
while t:
	solve()
	t -= 1


from sys import stdin, setrecursionlimit, maxsize
from collections import deque
from heapq import *
from math import sqrt, gcd
input = stdin.readline
setrecursionlimit(10 ** 5)
MAX = 100
p = [1] * MAX
p[0] = 0
p[1] = 0
for i in range(2, MAX):
	if p[i] == 0:
		continue
	for j in range(i * 2, MAX, i):
		p[j] = 0

def solve(s, k):
	for i in range(k):
		if s[i] == '1' or s[i] == '4' or s[i] == '6' or (s[i] == '8') or (s[i] == '9'):
			print(1)
			print(s[i])
			return 0
	for i in range(k):
		for j in range(i + 1, k):
			if p[int(s[i]) * 10 + int(s[j])] == 0:
				print(2)
				print(s[i] + s[j])
				return 0
for _ in range(int(input())):
	k = int(input())
	s = input().strip()
	solve(s, k)


def is_prime(num):
	if num > 1:
		for i in range(2, int(num / 2) + 1):
			if num % i == 0:
				return False
		else:
			return True
	else:
		return False

def solve():
	k = int(input())
	s = input()
	ax = [0 for i in range(10)]
	for i in range(k):
		if int(s[i]) == 1:
			print(1)
			print(1)
			return 0
		elif int(s[i]) != 2 and int(s[i]) != 3 and (int(s[i]) != 7) and (int(s[i]) != 5):
			print(1)
			print(s[i])
			return 0
	for i in range(k):
		ax[int(s[i])] += 1
		if ax[int(s[i])] == 2:
			print(2)
			print(s[i] * 2)
			return 0
	for i in range(k):
		for j in range(i + 1, k):
			a = s[i] + s[j]
			if not is_prime(int(a)):
				print(len(a))
				print(a)
				return
	print(3)
	print(s)
t = int(input())
for i in range(t):
	solve()


import math
from itertools import combinations

def isprime(x):
	for i in range(2, int(math.sqrt(x)) + 1):
		if x % i == 0:
			return False
	return True
for _ in range(int(input())):
	k = int(input())
	s = list(input())
	isTrue = True
	for n in s:
		if not isprime(int(n)):
			print(1)
			print(n)
			isTrue = False
			break
		elif n == '1':
			print(1)
			print(1)
			isTrue = False
			break
	if isTrue:
		for i in range(1, 10):
			chk = True
			for k in list(combinations(s, i)):
				if not isprime(int(''.join(k))):
					print(2)
					print(int(''.join(k)))
					chk = False
					break
			if not chk:
				break


from itertools import combinations
from math import sqrt
bad = {1, 4, 6, 8, 9}

def is_prime(n):
	if n < 2:
		return False
	if n % 2 == 0:
		return n == 2
	k = 3
	while k * k <= n:
		if n % k == 0:
			return False
		k += 2
	return True
for _ in range(int(input())):
	one = True
	k = int(input())
	n = int(input())
	for s in str(n):
		if int(s) in bad:
			print(1)
			print(int(s))
			one = False
			break
	sol = False
	if one:
		for i in range(2, k + 1):
			if sol == False:
				for j in combinations(str(n), i):
					if is_prime(int(''.join(j))) == False:
						print(i)
						print(int(''.join(j)))
						sol = True
						break


dic = {'1': '124568', '2': '1274568', '3': '2394568', '5': '1274568', '7': '274568'}
for _ in range(int(input())):
	k = int(input())
	n = input()
	ind = -1
	for i in range(k):
		if int(n[i]) % 2 == 0 and n[i] != '2' or n[i] == '1' or n[i] == '9':
			ind = i
			break
	if ind != -1:
		print(1)
		print(n[ind])
		continue
	ans = ''
	for i in dic.keys():
		for r in range(k):
			if n[r] == i:
				for e in range(r + 1, k):
					if n[e] in dic[i]:
						ans = n[r] + n[e]
						break
			if ans:
				break
	print(2)
	print(ans)


def isPrime(n):
	if n == 1:
		return 0
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return 0
	return 1
t = int(input())
for _ in range(t):
	x = int(input())
	k = input()
	f = 0
	for i in k:
		if isPrime(int(i)) == 0:
			f = i
			break
	if f:
		print(1)
		print(f)
	else:
		for i in range(len(k)):
			for j in range(i + 1, len(k)):
				if isPrime(int(k[i] + k[j])) == 0:
					f = k[i] + k[j]
					break
			if f:
				break
		print(2)
		print(f)


t = int(input())

def isPrime(x):
	i = 2
	while i * i <= x:
		if x % i == 0:
			return False
		i += 1
	return True

def solve():
	k = int(input())
	arr = [int(i) for i in input()]
	for i in arr:
		if not isPrime(i) or i == 1:
			print(1)
			print(i)
			return
	for i in range(k):
		for j in range(i + 1, k):
			val = str(arr[i]) + str(arr[j])
			if not isPrime(int(val)):
				print(2)
				print(str(arr[i]) + str(arr[j]))
				return
for i in range(t):
	solve()


def is_prime(n):
	if n == 2:
		return True
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def main():
	n = int(input())
	s = input()
	for i in range(n):
		x = int(s[i])
		if x == 0:
			continue
		if is_prime(x) == False or x == 1:
			print(1)
			print(x)
			return
	for i in range(n):
		if s[i] == '0':
			continue
		for j in range(i + 1, n):
			x = int(s[i] + s[j])
			if is_prime(x) == False:
				print(2)
				print(x)
				return
	for i in range(n):
		if s[i] == '0':
			continue
		for j in range(i + 1, n):
			for k in range(j + 1, n):
				x = int(s[i] + s[j] + s[k])
				if is_prime(n) == False:
					print(3)
					print(x)
					return
for ii in range(int(input())):
	main()


for i in range(int(input())):
	k = int(input())
	s = input()
	seen = ''
	l2 = []
	ans = ''
	(c1, c3, c7, c2, c5) = (0, 0, 0, 0, 0)
	for j in s:
		x = int(j)
		if x in (1, 4, 6, 8, 9):
			ans = str(x)
			break
		elif x in (5, 2):
			if len(seen) == 0:
				seen = str(x)
			else:
				ans = seen + str(x)
			if x == 2:
				c2 += 1
			else:
				c5 += 1
		elif x in (3, 7):
			if x != 3:
				if c2 > 0:
					ans = '2' + str(x)
				elif c5 > 0:
					ans = '5' + str(x)
			if len(seen) == 0:
				seen = str(x)
			if x == 3:
				c3 += 1
			elif x == 7:
				c7 += 1
	if len(ans) != 0:
		print(len(ans))
		print(ans)
	elif c3 > 1:
		print(2)
		print(33)
	elif c7 > 1:
		print(2)
		print(77)


for _ in range(int(input())):
	n = int(input())
	s = input()
	f = 0
	t = ''
	for i in s:
		if i in '14689':
			t = i
			f = 1
			break
	if f:
		print(1)
		print(t)
		continue
	d = set()
	f = 1
	for i in s:
		if i in d:
			print(2)
			print(i * 2)
			f = 0
			break
		d.add(i)
	if f:
		if s[0] != '5' and '5' in d:
			print(2)
			print(s[0] + '5')
			continue
		elif s[0] != '2' and '2' in d:
			print(2)
			print(s[0] + '2')
			continue
		elif '2' in d and '7' in d:
			print(2)
			print('27')
		elif '5' in d and '7' in d:
			print(2)
			print('57')


def f(a, b):
	c = (23, 37, 73, 53)
	return not a * 10 + b in c
for _ in range(int(input())):
	k = int(input())
	a = [int(i) for i in input()]
	c = (1, 4, 6, 8, 9)
	for i in a:
		if i in c:
			print(1)
			print(i)
			break
	else:
		print(2)
		if f(a[0], a[1]):
			print(f'{a[0]}{a[1]}')
		elif f(a[0], a[2]):
			print(f'{a[0]}{a[2]}')
		elif f(a[1], a[2]):
			print(f'{a[1]}{a[2]}')


q = int(input())

def get_primes(n):
	primes = list(range(n + 1))
	primes[1] = 0
	for i in primes:
		if i > 1:
			for j in range(i + i, len(primes), i):
				primes[j] = 0
	return primes
filter = [x for x in get_primes(100) if x != 0]
for _ in range(q):
	k = int(input())
	n = int(input())
	found = False
	a = [int(d) for d in str(n)]
	for i in range(k):
		if a[i] in [1, 4, 6, 8, 9]:
			print(1)
			print(a[i])
			found = True
			break
	if not found:
		if k > 1:
			dices = [i for (i, v) in enumerate(a) if (v == 2 or v == 5) and i != 0]
			if len(dices) > 0:
				i = dices[0]
				print(2)
				print(str(a[i - 1]) + str(a[i]))
				found = True
		if not found:
			for i in range(k):
				if found:
					break
				for j in range(i + 1, k):
					if found:
						break
					if a[i] == a[j] and a != 1:
						print(2)
						print(str(a[i]) + str(a[j]))
						found = True
					elif a[i] * 10 + a[j] not in filter:
						print(2)
						print(str(a[i] * 10 + a[j]))
						found = True
		if not found:
			print(1)
			print(0)


T = int(input())
for x in range(T):
	k = int(input())
	a = [int(y) for y in input()]
	p = [2, 3, 5, 7]
	np = [1, 4, 6, 8, 9]
	pi = [-1] * 4
	for z in range(k):
		if a[z] in np:
			ans = a[z]
			break
		else:
			ans = -1
			if a[z] == 2:
				pi[0] = z
			elif a[z] == 3:
				pi[1] = z
			elif a[z] == 5:
				pi[2] = z
			elif a[z] == 7:
				pi[3] = z
	if ans != -1:
		print(1)
		print(ans)
	elif pi[0] > 0:
		print(2)
		print(10 * a[pi[0] - 1] + a[pi[0]])
	elif pi[2] > 0:
		print(2)
		print(10 * a[pi[2] - 1] + a[pi[2]])
	elif a.count(3) > 1:
		print(2)
		print(33)
	elif a.count(7) > 1:
		print(2)
		print(77)
	elif pi[0] == 0 and pi[3] > 0:
		print(2)
		print(27)
	elif pi[2] == 0 and pi[3] > 0:
		print(2)
		print(57)


import math

def f(n):
	n = int(n)
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return True
	return False
t = int(input())
for i in range(t):
	n = int(input())
	a = input()
	t = True
	for j in a:
		if (j == '1' or j == '4' or j == '6' or (j == '8') or (j == '9')) and t:
			print(1)
			print(j)
			t = False
	if t:
		t = True
		for j in range(len(a)):
			for k in range(j + 1, len(a)):
				if f(a[j] + a[k]) and t:
					print(2)
					print(a[j] + a[k])
					t = False


import sys
input = sys.stdin.readline
prime = [1] * 100
for i in range(2, 100):
	if prime[i]:
		for j in range(i * i, 100, i):
			prime[j] = 0
for _ in range(int(input())):
	n = int(input().strip())
	num = list(map(int, input().strip()))
	for i in range(n):
		if num[i] != 2 and num[i] != 3 and (num[i] != 5) and (num[i] != 7):
			print(1)
			print(num[i])
			break
	else:
		broke = 0
		for i in range(n):
			if broke:
				break
			for j in range(i + 1, n):
				left = 10 * num[i] + num[j]
				if not prime[left]:
					print(2)
					print(left)
					broke = 1
					break


t = int(input())
for _ in range(t):
	n = int(input())
	s = str(input())
	key = 0
	for i in range(n):
		if s[i] in ['1', '4', '6', '8', '9']:
			key = 1
			val = s[i]
			break
	if key == 1:
		print(1)
		print(int(val))
	else:
		for i in range(n - 1):
			for j in range(i + 1, n):
				if i != j and s[i] + s[j] not in ['23', '53', '73', '37']:
					a = s[i] + s[j]
		print(2)
		print(a)


for _ in range(int(input())):
	n = int(input())
	l = list(input())
	f = 0
	for i in l:
		if i in ['1', '4', '6', '8', '9']:
			f = i
			break
	if f != 0:
		print(1)
		print(f)
	else:
		c = []
		for i in range(n):
			if l[i] in ['2', '3', '5', '7']:
				c.append(l[i])
		if c:
			for j in c:
				if j == '2':
					for i in range(1, len(c)):
						if c[i] in ['2', '5', '7']:
							print(2)
							print(j + c[i])
							f = 1
							break
				elif j == '3':
					for i in range(1, len(c)):
						if c[i] in ['2', '5', '3']:
							print(2)
							print(j + c[i])
							f = 1
							break
				elif j == '5':
					for i in range(1, len(c)):
						if c[i] in ['2', '5', '7']:
							print(2)
							print(j + c[i])
							f = 1
							break
				else:
					for i in range(1, len(c)):
						if c[i] in ['2', '5', '7']:
							print(2)
							print(j + c[i])
							f = 1
							break
				if f == 1:
					break