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
Tags: Constructive algorithms

Implementation

Complete search

Number theory

Mathematics
Skill types: Complete search

Starter code:

Solutions:
c = ['1', '4', '6', '8', '9']
c2 = ['25', '27', '32', '35', '52', '57', '72', '75']
t = int(input())
for _ in range(t):
	k = int(input())
	n = input()
	if k == 1:
		print(1)
		print(n)
		continue
	s = 0
	for x in c:
		if x in n:
			print(1)
			print(x)
			s = 1
			break
	if s:
		continue
	print(2)
	if k == 2:
		print(n)
		continue
	if n.count('2') >= 2:
		print(22)
		continue
	elif n.count('3') >= 2:
		print(33)
		continue
	elif n.count('5') >= 2:
		print(55)
		continue
	elif n.count('7') >= 2:
		print(77)
		continue
	for x in c2:
		if x in n:
			print(x)
			s = 1
			break
	if s:
		continue
	print(n[0] + n[2])


from itertools import combinations as perm

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return 0
	return 1
t = int(input())
for x in range(t):
	k = int(input())
	n = int(input())
	a = str(n)
	s = list(set(a))
	f = 0
	for i in s:
		if isprime(int(i)) == 0 or i == '1':
			f = 1
			print(1)
			print(i)
			break
	if f == 0 and k == 2:
		print(len(a))
		print(n)
	elif f == 0:
		while f == 0:
			i = 2
			for j in perm(a, i):
				b = ''.join(j)
				q = b
				b = int(b)
				if isprime(b) == 0:
					print(i)
					print(b)
					f = 1
					break
			i += 1
			if i == len(a) + 1:
				print(len(a))
				print(n)
				break


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	flag = True
	for i in [str(1), str(4), str(6), str(8), str(9)]:
		if i in s:
			print(1)
			print(i)
			flag = False
			break
	if flag:
		if '3' in s and '2' in s and (s.index('3') < s.index('2')):
			print(2)
			print(32)
		elif '2' in s and '7' in s and (s.index('2') < s.index('7')):
			print(2)
			print(27)
		elif '2' in s and '7' in s and (s.index('7') < s.index('2')):
			print(2)
			print(72)
		elif '2' in s and '5' in s and (s.index('2') < s.index('5')):
			print(2)
			print(25)
		elif '2' in s and '5' in s and (s.index('5') < s.index('2')):
			print(2)
			print(52)
		elif '3' in s and '5' in s and (s.index('3') < s.index('5')):
			print(2)
			print(35)
		elif '7' in s and '5' in s and (s.index('7') < s.index('5')):
			print(2)
			print(75)
		elif '7' in s and '5' in s and (s.index('5') < s.index('7')):
			print(2)
			print(57)
		elif '2' in s and s.count('2') >= 2:
			print(2)
			print(22)
		elif '3' in s and s.count('3') >= 2:
			print(2)
			print(33)
		elif '5' in s and s.count('5') >= 2:
			print(2)
			print(55)
		elif '7' in s and s.count('7') >= 2:
			print(2)
			print(77)


comp = [1, 4, 6, 8, 9]
test = int(input())
for jj in range(test):
	n = int(input())
	num = input()
	res = [int(x) for x in str(num)]
	if 1 in res:
		print(1)
		print(1)
	elif 4 in res:
		print(1)
		print(4)
	elif 6 in res:
		print(1)
		print(6)
	elif 8 in res:
		print(1)
		print(8)
	elif 9 in res:
		print(1)
		print(9)
	elif res.count(2) > 1:
		print(2)
		print(22)
	elif res.count(3) > 1:
		print(2)
		print(33)
	elif res.count(5) > 1:
		print(2)
		print(55)
	elif res.count(7) > 1:
		print(2)
		print(77)
	elif 5 in res and res.index(5) > 0:
		print(2)
		print(int(str(res[0]) + str(5)))
	elif 2 in res and res.index(2) > 0:
		print(2)
		print(int(str(res[0]) + str(2)))
	elif 2 in res and 7 in res and (res.index(2) < res.index(7)):
		print(2)
		print(27)
	elif 5 in res and 7 in res and (res.index(5) < res.index(7)):
		print(2)
		print(57)
	else:
		print(n)
		print(int(num))


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()


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

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

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	box = []
	for p in range(n + 1):
		if prime[p]:
			box.append(p)
	return box

def main():
	t = int(input())
	box = set(SieveOfEratosthenes(10000))
	cont = []
	for num in range(1, 10001):
		if num not in box:
			cont.append(list(str(num)))
	for _ in range(t):
		n = int(input())
		number = int(input())
		for nums in cont:
			loop = False
			i = 0
			for char in str(number):
				if char == nums[i]:
					i += 1
				if i == len(nums):
					loop = True
					break
			if loop:
				print(len(nums))
				print(''.join(nums))
				break
main()


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 = input()
	ans = 0
	if '1' in n:
		ans = 1
		print(ans)
		print(1)
	elif '4' in n:
		ans = 1
		print(ans)
		print(4)
	elif '6' in n:
		ans = 1
		print(ans)
		print(6)
	elif '8' in n:
		ans = 1
		print(ans)
		print(8)
	elif '9' in n:
		ans = 1
		print(ans)
		print(9)
	else:
		a = n.count('2')
		b = n.count('3')
		c = n.count('5')
		d = n.count('7')
		if a > 1:
			print(2)
			print(22)
		elif b > 1:
			print(2)
			print(33)
		elif c > 1:
			print(2)
			print(55)
		elif d > 1:
			print(2)
			print(77)
		else:
			print(2)
			if a >= 1:
				x = n.find('2')
				y = n.find('5')
				z = n.find('7')
				if x < y:
					print(25)
				elif x < z:
					print(27)
				else:
					print(int(n[x - 1:x + 1]))
			else:
				x = n.find('3')
				y = n.find('5')
				z = n.find('7')
				if x < y and x != -1:
					print(35)
				elif y < z and y != -1:
					print(57)
				else:
					print(75)


for s in [*open(0)][2::2]:
	print((t := ({*'14689'} & {*s})) and '1\n' + t.pop() or '2\n' + ((t := ({*'25'} & {*s[1:]})) and s[0] + t.pop() or ((t := [x for x in s if s.count(x) > 1]) and 2 * t[0]) or s.replace('3', '')))


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


from collections import Counter
for _ in range(int(input())):
	k = int(input())
	n = input()
	np = [1, 4, 6, 8, 9]
	c = 0
	for i in range(5):
		if n.count(str(np[i])) > 0:
			c += 1
			print(1)
			print(np[i])
			break
	if c == 0:
		count = Counter(n)
		if count['2'] > 0:
			if count['2'] > 1:
				print(2)
				print(22)
				c += 1
			elif count['7'] > 0 and n.index('2') < n.index('7'):
				print(2)
				print(27)
				c += 1
			elif count['5'] > 0 and n.index('2') < n.index('5'):
				print(2)
				print(25)
				c += 1
		if c == 0:
			if count['5'] > 0:
				if count['2'] > 0 and n.index('5') < n.index('2'):
					print(2)
					print(52)
					c += 1
				elif count['5'] > 1:
					print(2)
					print(55)
					c += 1
				elif count['7'] > 0 and n.index('5') < n.index('7'):
					print(2)
					print(57)
					c += 1
		if c == 0:
			if count['3'] > 0:
				if count['3'] > 1:
					print(2)
					print(33)
					c += 1
				elif count['2'] > 0 and n.index('3') < n.index('2'):
					print(2)
					print(32)
					c += 1
				elif count['5'] > 0 and n.index('3') < n.index('5'):
					print(2)
					print(35)
					c += 1
		if c == 0:
			if count['7'] > 0:
				if count['7'] > 1:
					print(2)
					print(77)
					c += 1
				elif count['2'] > 0 and n.index('7') < n.index('2'):
					print(2)
					print(72)
					c += 1
				elif count['5'] > 0 and n.index('7') < n.index('5'):
					print(2)
					print(75)
					c += 1
			else:
				print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
				print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
				print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
				print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
				print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')


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 collections import Counter
from itertools import product, chain
magic = {'273': '27', '237': '27', '573': '57', '537': '57'}

def solve():
	input()
	x = input()
	l = len(x)
	c = Counter(x)
	for s in '14689':
		if c[s] >= 1:
			print(1)
			print(s)
			return
	for s in '2357':
		if c[s] >= 2:
			print(2)
			print(s + s)
			return
	for s in '25':
		if c[s] >= 1 and x[0] != s:
			print(2)
			print(x[0] + s)
			return
	if x in magic:
		print(2)
		print(magic[x])
		return
	print(l)
	print(x)
n = int(input())
for _ in range(n):
	solve()


from itertools import combinations
from math import sqrt

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

def solve(s):
	for x in '14689':
		if x in s:
			print(1)
			print(x)
			return
	for x in '2357':
		if s.count(x) == 2:
			print(2)
			print(x * 2)
			return
	for i in range(1, len(s) + 1):
		for c in combinations(s, i):
			t = ''.join(c)
			if not is_prime(int(t)):
				print(i)
				print(t)
				return

def main():
	n_sets = int(input())
	for i in range(n_sets):
		n = int(input())
		s = input()
		solve(s)
main()


import math

def prime(n):
	if n % 2 == 0:
		return True
	for i in range(3, int(math.sqrt(n) + 1)):
		if n % i == 0:
			return True
	return False
for _ in range(int(input())):
	k = int(input())
	s = input()
	f = 10 * [0]
	for i in s:
		f[ord(i) - 48] += 1
	if f[1] > 0:
		print(1)
		print(1)
	elif f[4] > 0:
		print(1)
		print(4)
	elif f[6] > 0:
		print(1)
		print(6)
	elif f[8] > 0:
		print(1)
		print(8)
	elif f[9] > 0:
		print(1)
		print(9)
	elif f[2] > 1:
		print(2)
		print(22)
	elif f[3] > 1:
		print(2)
		print(33)
	elif f[5] > 1:
		print(2)
		print(55)
	elif f[7] > 1:
		print(2)
		print(77)
	else:
		z = 0
		for i in range(1, 10):
			for j in range(1, 10):
				if f[i] > 0 and f[j] > 0 and (s.index(str(i)) < s.index(str(j)) or s.index(str(i)) < s.rindex(str(j))):
					n1 = i * 10 + j
					if i == j and f[i] < 2:
						continue
					elif prime(n1):
						print(2)
						print(n1)
						z = -1
						break
				if z == -1:
					break


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)


one = ['1', '4', '6', '8', '9']
two = ['22', '25', '27', '32', '33', '35', '52', '55', '57', '72', '75', '77']
t = int(input())
for _ in range(t):
	k = int(input())
	n = input()
	answer = ''
	for lst in (one, two):
		for composite in lst:
			p_composite = 0
			for digit_of_n in n:
				if digit_of_n == composite[p_composite]:
					p_composite += 1
					if p_composite == len(composite):
						answer = composite
						break
			if answer != '':
				break
		if answer != '':
			break
	print(len(answer))
	print(answer)


import sys
import math
import random
import heapq
input = sys.stdin.readline

def pow(a, n, m):
	if n == 0:
		return 1
	x = pow(a, n // 2, m)
	if n % 2 == 0:
		return x * x % m
	else:
		return x * x * a % m

def gcd(a, b):
	while b != 0:
		(a, b) = (b, a % b)
	return a

def bs(arr, le, ri):
	l = 0
	arr.sort()
	r = len(arr) - 1
	ans = 10000000
	while l <= r:
		m = (l + r) // 2
		if arr[m] >= le and arr[m] <= ri:
			ans = arr[m]
			r = m - 1
		elif arr[m] < le:
			l = m + 1
		else:
			r = m - 1
	return ans
t = int(input())
while t > 0:
	k = int(input())
	l = input().strip()
	f = 0
	ls = ['1', '4', '6', '8', '9']
	for i in ls:
		if i in l:
			print(1)
			print(i)
			f = 1
			break
	if f == 0:
		if k == 1:
			print(1)
			print(k)
		else:
			ls = ['2', '3', '5', '7']
			f = 0
			for i in ls:
				if l.count(i) >= 2:
					print(2)
					for j in range(2):
						print(i, end='')
					print()
					f = 1
					break
			if f == 0:
				if '2' in l[1:]:
					print(2)
					print(l[0] + '2')
				elif '5' in l[1:]:
					print(2)
					print(l[0] + '5')
				elif k == 3:
					print(2)
					print(l[0] + '7')
				else:
					print(k)
					print(l)
	t -= 1


def run():
	t = int(input())
	for i in range(t):
		k = int(input())
		lst = []
		lst = list(input())
		lst = [int(i) for i in lst]
		(a, b) = f(lst)
		print(a)
		print(b)

def f(lst):
	for x in (1, 4, 6, 8, 9):
		if x in lst:
			return (1, x)
	if 2 in lst[1:]:
		return (2, lst[0] * 10 + 2)
	if lst[0] == 2:
		for x in (5, 7):
			if x in lst:
				return (2, 20 + x)
		return (2, 33)
	if 5 in lst[1:]:
		return (2, lst[0] * 10 + 5)
	if lst[0] == 5:
		if 7 in lst:
			return (2, 57)
		return (2, 33)
	if 3 in lst:
		if 3 in lst[lst.index(3) + 1:]:
			return (2, 33)
		else:
			return (2, 77)
	return (2, 77)
run()


def change(n):
	l = []
	while n != 0:
		l.append(n % 10)
		n = n // 10
	return l[::-1]
for _ in range(int(input())):
	k = int(input())
	n = int(input())
	if k == 1:
		print(1)
		print(n)
	else:
		l = change(n)
		d = {}
		f = 0
		for i in range(k):
			if l[i] == 1:
				f = 1
				print(1)
				print(1)
				break
			elif l[i] % 2 == 0 and l[i] != 2:
				f = 1
				print(1)
				print(l[i])
				break
			elif l[i] == 9:
				f = 1
				print(1)
				print(9)
				break
		if f == 0:
			for i in range(k):
				d[l[i]] = d.get(l[i], 0) + 1
				if d[l[i]] > 1:
					f = 1
					print(2)
					print(l[i] * 10 + l[i])
					break
		if f == 0:
			for i in range(k):
				if l[i] == 2 or l[i] == 5:
					if i != 0:
						f = 1
						print(2)
						print(l[i - 1] * 10 + l[i])
						break
		if f == 0:
			if l[0] == 2:
				print(2)
				print(27)
			else:
				print(2)
				print(57)


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


import sys
input = sys.stdin.readline
from collections import Counter
for _ in range(int(input())):
	k = int(input())
	n = input()[:-1]
	if k == 1:
		print(1)
		print(n)
	else:
		cnt = Counter(n)
		for c in n:
			if c in '14689':
				print(1)
				print(c)
				break
		else:
			for (x, v) in cnt.items():
				if v >= 2:
					print(2)
					print(x * 2)
					break
			else:
				for i in range(1, k):
					if n[i] in '25':
						print(2)
						print(n[i - 1] + n[i])
						break
				else:
					print(2)
					print(n[0] + '7')


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 vaild(cur):
	for i in range(2, cur):
		if cur % i == 0:
			return True
	return False

def solve():
	n = int(input())
	s = input()
	cnt = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0}
	for i in s:
		cnt[ord(i) - ord('0')] += 1
	c = [1, 4, 6, 8, 9]
	for i in c:
		if cnt[i]:
			print(1)
			print(i)
			return 0
	print(2)
	cur = 0
	for i in range(n):
		for j in range(i + 1, n):
			cur = (ord(s[i]) - ord('0')) * 10 + (ord(s[j]) - ord('0'))
			if vaild(cur):
				print(cur)
				return 0
	return 0
t = int(input())
while t > 0:
	solve()
	t = t - 1


import sys
from collections import Counter
t = int(input())
ans = []
not_prime_digits = [str(i) for i in [1, 4, 6, 8, 9]]
for w in range(t):
	k = int(input())
	n = input()
	c = Counter(n)
	solved = False
	for i in not_prime_digits:
		if i in c.keys():
			ans.append(1)
			ans.append(i)
			solved = True
		if solved:
			break
	if solved:
		continue
	(k, v) = c.most_common()[0]
	if v >= 2:
		ans.append(2)
		ans.append(str(k) * 2)
		continue
	ans.append(2)
	if n[0] == '2':
		if '5' in c.keys():
			res = '25'
		else:
			res = '27'
	elif n[0] == '5':
		if '2' in c.keys():
			res = '52'
		else:
			res = '57'
	elif '2' in c.keys():
		res = n[0] + '2'
	else:
		res = n[0] + '5'
	ans.append(res)
print(*ans, sep='\n')


from collections import defaultdict

def main():
	test = int(input())
	one_digit = ['1', '4', '6', '8', '9']
	prime = [23, 37, 53, 73]
	for _ in range(test):
		n = int(input())
		s = input().strip('\r\n')
		ans = [0] * 2
		if n == 1:
			ans[0] = 1
			ans[1] = int(s[0])
			for i in ans:
				print(i)
			continue
		flag = False
		for i in one_digit:
			if i in s:
				flag = True
				ans[0] = 1
				ans[1] = int(i)
				break
		if flag:
			for i in ans:
				print(i)
			continue
		cnt = defaultdict(int)
		for i in s:
			c = int(i)
			for j in cnt.keys():
				num = j * 10 + c
				if num not in prime:
					ans[0] = 2
					ans[1] = num
					flag = True
					break
			if flag:
				break
			cnt[c] += 1
		if flag:
			for i in ans:
				print(i)
			continue
	return
main()


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())
for _ in range(t):
	n = int(input())
	l = input()
	flag = 0
	x = [str(i) for i in [25, 35, 75, 55, 32, 52, 72, 22, 33, 77, 27, 57]]
	for i in '14689':
		if i in l:
			print(1)
			print(i)
			flag = 1
			break
	if flag == 0:
		print(2)
		for i in range(n - 1):
			for j in range(i + 1, n):
				if l[i] + l[j] in x:
					print(l[i] + l[j])
					flag = 1
					break
			if flag == 1:
				break
	else:
		continue


from math import sqrt

def is_prime(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
t = int(input(''))
compo = [1, 4, 6, 8, 9]
unpo = [23, 37, 73, 53]
for l in range(t):
	ans = []
	n = int(input(''))
	no = list(input())
	for i in compo:
		if str(i) in ''.join(no):
			ans = [i]
			break
	if len(ans) == 1:
		print(1)
		print(ans[0])
	else:
		for i in range(n):
			for j in range(i + 1, n):
				temp = no[i] + no[j]
				if int(temp) not in unpo:
					ans = [temp]
					break
		print(2)
		print(ans[0])


import sys
input = sys.stdin.readline

def the_sieve_of_eratosthenes(n):
	s = [1] * (n + 1)
	x = []
	for i in range(2, n + 1):
		if s[i]:
			x.append(i)
			for j in range(i, n + 1, i):
				s[j] = 0
	return x
t = int(input())
p = set(the_sieve_of_eratosthenes(10000))
x = []
for i in range(1, 10001):
	if not i in p:
		x.append(list(str(i)))
for _ in range(t):
	k = int(input())
	n = list(input().rstrip())
	for y in x:
		ok = 0
		(j, l) = (0, len(y))
		for i in n:
			if y[j] == i:
				j += 1
			if j == l:
				ok = 1
				break
		if ok:
			ans = ''.join(y)
			d = len(y)
			break
	print(d)
	print(ans)


from collections import Counter
for _ in range(int(input())):
	k = int(input())
	n = input()
	for dig in ['1', '4', '6', '8', '9']:
		if dig in n:
			print(1)
			print(dig)
			break
	else:
		c = Counter(n)
		for dig in c:
			if c[dig] >= 2:
				print(2)
				print(dig * 2)
				break
		else:
			if '2' in n and n[0] != '2':
				print(2)
				print(n[0] + '2')
			elif '5' in n and n[0] != '5':
				print(2)
				print(n[0] + '5')
			elif n[0] == '2' and '7' in n:
				print(2)
				print(27)
			elif n[0] == '5' and '7' in n:
				print(2)
				print(57)
			else:
				print(len(n))
				print(n)


import math

def checkprime(n):
	if n < 2:
		return False
	i = 2
	while i <= int(math.sqrt(n)):
		if n % i == 0:
			return False
		i += 1
	return True
for _ in range(int(input())):
	n = int(input())
	s = input()
	A = list((int(i) for i in s))
	ans = -1
	for i in range(n):
		if checkprime(A[i]) is False:
			ans = A[i]
	if ans != -1:
		print(1)
		print(ans)
		continue
	for i in range(n):
		for j in range(i + 1, n):
			if checkprime(int(str(A[i]) + str(A[j]))) is False:
				ans = int(str(A[i]) + str(A[j]))
	if ans != -1:
		print(2)
		print(ans)
		continue


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


from sys import *
input = stdin.readline
import random
from bisect import *
import math
from collections import *
import operator
from heapq import *
from itertools import *
inf = 10 ** 18
mod = 10 ** 9 + 7

def check(s):
	s = str(s)
	i = 0
	j = 0
	while i < len(k) and j < len(s):
		if int(s[j]) == k[i]:
			i += 1
			j += 1
		else:
			i += 1
	if j == len(s):
		return True
	return False

def iscomp(n):
	if n == 0:
		return False
	if n == 1:
		return True
	i = 2
	while i * i <= n:
		if n % i == 0:
			return True
		i += 1
	return False
for _ in range(int(input())):
	n = int(input())
	k = list(input())[:-1]
	for i in range(n):
		k[i] = int(k[i])
	i = 1
	while True:
		if iscomp(i) and check(i):
			print(len(str(i)))
			print(i)
			break
		else:
			i += 1


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()


from sys import stdin
input = stdin.readline
primes = [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]
for _ in range(int(input().strip())):
	N = int(input().strip())
	a = [i for i in input().strip()]
	allprimes = sum([1 for i in a if int(i) in primes]) == N
	if not allprimes:
		print(1)
		print([i for i in a if int(i) not in primes][0])
		continue
	print(2)
	found = False
	for i in range(N - 1):
		for j in range(i + 1, N):
			if not int(a[i] + a[j]) in primes:
				print(int(a[i] + a[j]))
				found = True
				break
		if found:
			break


t = int(input())
for _ in range(t):
	k = int(input())
	n = input()
	if '1' in n or '4' in n or '6' in n or ('8' in n) or ('9' in n):
		print(1)
		for a in ['1', '4', '6', '8', '9']:
			if a in n:
				print(int(a))
				break
	elif n.count('2') >= 2 or n.count('3') >= 2 or n.count('5') >= 2 or (n.count('7') >= 2):
		print(2)
		for a in ['2', '3', '5', '7']:
			if n.count(a) >= 2:
				print(10 * int(a) + int(a))
				break
	else:
		if k == 4:
			for i in range(4):
				if n[i] == '2':
					break
			for j in range(4):
				if n[j] == '5':
					break
			if i < j:
				print(2)
				print(25)
			else:
				print(2)
				print(52)
		if k == 3:
			if '2' in n:
				for i in range(3):
					if n[i] == '2':
						break
				if i > 0:
					print(2)
					print(int(n[0]) * 10 + 2)
				elif '5' in n:
					print(2)
					print(25)
				else:
					print(2)
					print(27)
			else:
				for i in range(3):
					if n[i] == '5':
						break
				if i > 0:
					print(2)
					print(int(n[0]) * 10 + 5)
				else:
					print(2)
					print(57)
		if k == 2:
			print(2)
			print(n)


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)


import sys

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

def maps():
	return [int(i) for i in input().split()]

def isprime(num):
	if num > 1:
		for i in range(2, int(num / 2) + 1):
			if num % i == 0:
				return True
		else:
			return False
	else:
		return False
from collections import defaultdict
for _ in range(*maps()):
	(k,) = maps()
	num = input()
	if '1' in num:
		print(1, 1, sep='\n')
		continue
	A = []
	for i in range(1, 100):
		if isprime(i):
			A.append(i)
	d = defaultdict(int)
	for i in num:
		d[i] += 1
	for i in A:
		i = str(i)
		if len(i) == 2:
			d[i[0]] -= 1
			d[i[1]] -= 1
			if d[i[0]] >= 0 and d[i[1]] >= 0:
				idx1 = num.index(i[0])
				idx2 = k - num[::-1].index(i[1]) - 1
				if idx1 < idx2:
					print(len(i), i, sep='\n')
					break
			d[i[0]] += 1
			d[i[1]] += 1
		elif len(i) == 1:
			d[i[0]] -= 1
			if d[i[0]] >= 0:
				print(1, i, sep='\n')
				break
			d[i[0]] += 1
	else:
		print(-1)


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)


import sys
input = sys.stdin.readline
from math import sqrt
for _ in range(int(input())):
	k = int(input())
	n = input()[:-1]
	if k == 1:
		print(1)
		print(n)
	else:
		for x in '14689':
			if x in n:
				print(1)
				print(x)
				break
		else:

			def check(x):
				for i in range(2, int(sqrt(x)) + 1):
					if not x % i:
						return True
				return False
			(left, right) = ({}, {})
			for (i, c) in enumerate(n):
				left.setdefault(c, i)
				right[c] = i
			if '2' in left and '5' in right and (right['5'] > left['2']):
				print(2)
				print('25')
			elif '2' in left and '7' in right and (right['7'] > left['2']):
				print(2)
				print('27')
			elif '2' in left and '2' in right and (right['2'] > left['2']):
				print(2)
				print('22')
			elif '3' in left and '5' in right and (right['5'] > left['3']):
				print(2)
				print('35')
			elif '3' in left and '2' in right and (right['2'] > left['3']):
				print(2)
				print('32')
			elif '3' in left and '3' in right and (right['3'] > left['3']):
				print(2)
				print('33')
			elif '5' in left and '2' in right and (right['2'] > left['5']):
				print(2)
				print('52')
			elif '5' in left and '7' in right and (right['7'] > left['5']):
				print(2)
				print('57')
			elif '5' in left and '5' in right and (right['5'] > left['5']):
				print(2)
				print('55')
			elif '7' in left and '2' in right and (right['2'] > left['7']):
				print(2)
				print('72')
			elif '7' in left and '5' in right and (right['5'] > left['7']):
				print(2)
				print('75')
			elif '7' in left and '7' in right and (right['7'] > left['7']):
				print(2)
				print('77')


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


num_inp = lambda : int(input())
arr_inp = lambda : list(map(int, input().split()))
sp_inp = lambda : map(int, input().split())
str_inp = lambda : input()
for s in [*open(0)][2::2]:
	print((t := ({*'14689'} & {*s})) and '1\n' + t.pop() or '2\n' + ((t := ({*'25'} & {*s[1:]})) and s[0] + t.pop() or [x * 2 for x in (*s, '') if s.count(x) ^ 1][0] or s.replace('3', '')))


t = int(input())
for _ in range(t):
	d = int(input())
	n = input()
	if d == 1:
		print('1\n' + n)
	elif '4' in n:
		print('1\n4')
	elif '6' in n:
		print('1\n6')
	elif '8' in n:
		print('1\n8')
	elif '9' in n:
		print('1\n9')
	elif '1' in n:
		print('1\n1')
	else:
		k = n.rfind('5')
		if k > 0:
			print('2\n' + n[0] + '5')
		elif k == 0:
			if '7' in n:
				print('2\n57')
			elif '2' in n:
				print('2\n52')
			else:
				print('2\n33')
		else:
			k = n.rfind('2')
			if k > 0:
				print('2\n' + n[0] + '2')
			elif k == 0:
				if '7' in n:
					print('2\n27')
				else:
					print('2\n33')
			else:
				a = n.find('3')
				b = n.rfind('3')
				if a != b:
					print('2\n33')
				else:
					print('2\n77')


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


def is_easy(x):
	d = int(x ** 0.5)
	for j in range(2, d + 1):
		if x % j == 0:
			return False
	return True
for _ in range(int(input())):
	k = int(input())
	s = input()
	d = '14689'
	f = False
	for i in d:
		if i in s:
			print(1)
			print(i)
			f = True
			break
	if f:
		continue
	for i in range(k):
		for j in range(i + 1, k):
			d = int(s[i]) * 10 + int(s[j])
			if not is_easy(d):
				print(2)
				print(d)
				f = True
				break
		if f:
			break
	if f:
		continue
	for i in range(k):
		for j in range(i + 1, k):
			for z in range(j + 1, k):
				d = int(s[i]) * 100 + int(s[j]) * 10 + s[z]
				if not is_easy(d):
					print(3)
					print(d)
					f = True
					break
			if f:
				break
		if f:
			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


import sys
import math
import heapq
import bisect
from collections import Counter
from collections import defaultdict
from io import BytesIO, IOBase
from itertools import permutations
import string

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		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
		self.BUFSIZE = 8192

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.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 = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.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:
			self.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')

def get_int():
	return int(input())

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

def get_int_grid(n):
	return [get_ints() for _ in range(n)]

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

def get_strs():
	return get_str().split(' ')

def flat_list(arr):
	return [item for subarr in arr for item in subarr]

def yes_no(b):
	if b:
		return 'YES'
	else:
		return 'NO'

def binary_search(good, left, right, delta=1, right_true=False):
	limits = [left, right]
	while limits[1] - limits[0] > delta:
		if delta == 1:
			mid = sum(limits) // 2
		else:
			mid = sum(limits) / 2
		if good(mid):
			limits[int(right_true)] = mid
		else:
			limits[int(~right_true)] = mid
	if good(limits[int(right_true)]):
		return limits[int(right_true)]
	else:
		return False

def prefix_sums(a):
	p = [0]
	for x in a:
		p.append(p[-1] + x)
	return p

def solve_a():
	(l, r) = get_ints()
	if l <= r // 2 + 1:
		return (r - 1) // 2
	else:
		return r - l

def substring(s, t):
	(n, m) = (len(s), len(t))
	i = 0
	j = 0
	while i < n and j < m:
		if s[i] == t[j]:
			i += 1
		j += 1
	return i == n

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

def solve_b():
	n = get_int()
	s = list(get_str())
	for i in range(1, 500):
		if not isprime(i) and substring(str(i), s):
			print(len(str(i)))
			print(i)
			return
t = get_int()
for _ in range(t):
	solve_b()


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)


for _ in range(int(input())):
	n = int(input())
	s = input()
	if {'1', '4', '6', '8', '9'}.intersection(set([t for t in s])):
		print(1, list(set(set([t for t in s])) & {'1', '4', '6', '8', '9'})[0], sep='\n')
	else:
		for i in range(n):
			for j in range(i + 1, n):
				if any((int(s[i] + s[j]) % t == 0 for t in range(2, 10))):
					print(2, s[i] + s[j], sep='\n')
					break
			else:
				continue
			break


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


for _ in range(int(input())):
	k = int(input())
	n = input()
	for x in set(n):
		if x not in ['2', '3', '5', '7']:
			print(1)
			print(x)
			break
	else:
		boob = 0
		for itr1 in range(k - 1):
			for itr2 in range(itr1 + 1, k):
				x = int(''.join(n[itr1] + n[itr2]))
				if x not in [11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]:
					print(2)
					print(x)
					boob = 1
					break
			if boob == 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


import math
import heapq
import string
from collections import deque
from bisect import bisect, bisect_left, bisect_right, insort
import sys
input = sys.stdin.readline
S = lambda : input().rstrip()
I = lambda : int(S())
M = lambda : map(int, S().split())
L = lambda : list(M())
H = 1000000000 + 7
for _ in range(I()):
	n = I()
	s = S()
	l = [0] * 9
	a = []
	for i in range(9):
		l[i] = s.find(str(i + 1))
	m = max(l[0], l[3], l[5], l[7], l[8])
	if m != -1:
		a.append([1, s[m]])
	s1 = s[::-1]
	t = s1.find('2')
	f = s1.find('5')
	if t != -1 and t != n - 1:
		a.append([2, s1[t + 1] + s1[t]])
	if f != -1 and f != n - 1:
		a.append([2, s1[f + 1] + s1[f]])
	if s.find('77') != -1:
		a.append([2, 77])
	if s.find('33') != -1:
		a.append([2, 33])
	if s[0] == '2':
		a.append([2, 27])
	elif s[0] == '5':
		a.append([2, 57])
	elif s[0] == '3':
		a.append([2, 33])
	else:
		a.append([2, 77])
	a.sort(key=lambda x: x[0])
	print(a[0][0])
	print(a[0][1])


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


t = int(input())
l = '14689'
two_digits = ['22', '32', '52', '72', '25', '35', '55', '75', '27', '57', '33', '77']

def solve():
	digits = input()
	k = input()
	for i in l:
		if i in k:
			print(1)
			print(i)
			return
	for i in range(len(k)):
		for j in range(i + 1, len(k)):
			if k[i] + k[j] in two_digits:
				print(2)
				print(k[i] + k[j])
				return
for _ in range(t):
	solve()


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from collections import Counter
from bisect import bisect_left
import sys
from queue import PriorityQueue
import operator as op
from functools import reduce
import re
mod = 1000000007
iinp = lambda : int(sys.stdin.readline())
inp = lambda : sys.stdin.readline().strip()
strl = lambda : list(inp().strip().split(' '))
intl = lambda : list(map(int, inp().split(' ')))
mint = lambda : map(int, inp().split())
flol = lambda : list(map(float, inp().split(' ')))
flush = lambda : sys.stdout.flush()

def myCode():
	n = iinp()
	s = input()
	ans = 0
	for i in ['1', '4', '6', '8', '9']:
		if i in s:
			ans = int(i)
	if ans:
		print(1)
		print(ans)
		return
	arr = ['23', '53', '37', '73']
	for i in range(len(s)):
		for j in range(i + 1, len(s)):
			if s[i] + s[j] not in arr:
				ans = int(s[i] + s[j])
				break
	print(2)
	print(ans)
	return

def main():
	for t in range(iinp()):
		myCode()
main()


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


p = print
for s in [*open(0)][2::2]:
	if (t := ({*'14689'} & {*s})):
		p(1)
		p(t.pop())
	elif (t := ({*'25'} & {*s[1:]})):
		p(2)
		p(s[0] + t.pop())
	elif (t := [x for x in s if s.count(x) > 1]):
		p(2)
		p(t[0] * 2)
	else:
		p(2)
		p(s.replace('3', ''))


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)


forbidden = {1: {2, 3, 5, 7}, 2: {23, 37, 53, 73}, 3: {233, 223, 373, 733}, 4: {2333, 2237, 3733, 7333}, 5: {23333, 37337}, 6: []}

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 _ in range(int(input())):
	n = int(input())
	s = input()
	s = str(s)
	ans = ''
	for k in range(1, 7):
		for i in range(10 ** (k - 1), 10 ** k):
			if i in forbidden[k]:
				continue
			cand = str(i)
			if '0' in cand:
				continue
			if isSubSequence(cand, s):
				ans = cand
				break
		if ans != '':
			break
	print(len(ans))
	print(ans)


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)


comp = ['1', '4', '6', '8', '9']
for _ in range(int(input())):
	a = int(input())
	b = input()
	d = {}
	for i in b:
		if i not in d:
			d[i] = 0
		d[i] += 1
	ch = 0
	ans = ''
	for i in comp:
		if i in d.keys():
			ans = i
			ch += 1
	if ch > 0:
		print('1\n' + ans)
	elif '2' in d and d['2'] > 1:
		print('2\n22')
	elif '3' in d and d['3'] > 1:
		print('2\n33')
	elif '5' in d and d['5'] > 1:
		print('2\n55')
	elif '7' in d and d['7'] > 1:
		print('2\n77')
	elif b[1:].count('2'):
		print('2\n' + b[0] + '2')
	elif b[1:].count('5'):
		print('2\n' + b[0] + '5')
	elif '2' in d and '7' in d:
		print('2\n27')
	elif '5' in d and '7' in d:
		print('2\n57')


t = int(input())
np = [1, 4, 6, 8, 9]
from collections import Counter as c

def solution(n, b):
	ans = 1
	no = ''
	tr1 = 0
	tr2 = 0
	for i in b:
		if int(i) in np:
			ans1 = 1
			no1 = i
			tr1 = 1
		if b[i] >= 2:
			ans2 = 2
			no2 = 2 * i
			tr2 = 1
	if tr1 and tr2:
		return (ans1, no1)
	elif tr1 == 1 and tr2 == 0:
		return (ans1, no1)
	elif tr1 == 0 and tr2 == 1:
		return (ans2, no2)
	ans = 2
	for i in n:
		if i == '2':
			if '5' in b:
				return (ans, '25')
			elif '7' in b:
				return (ans, '27')
		elif i == '3':
			if '2' in b:
				return (ans, '32')
			elif '5' in b:
				return (ans, '35')
		elif i == '5':
			if '2' in b:
				return (ans, '52')
			elif '7' in b:
				return (ans, '57')
		elif i == '7':
			if '2' in b:
				return (ans, '72')
			elif '5' in b:
				return (ans, '75')
for _ in range(t):
	k = int(input())
	n = input()
	b = c(n)
	(ans, no) = solution(n, b)
	print(ans)
	print(no)


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


import itertools
from sys import maxsize, stdout, stdin, stderr
mod = int(1000000000.0 + 7)
import sys

def I():
	return int(stdin.readline())

def lint():
	return [int(x) for x in stdin.readline().split()]

def S():
	return list(map(str, input().strip()))

def grid(r, c):
	return [lint() for i in range(r)]
from collections import defaultdict, Counter, deque
import math
import heapq
from heapq import heappop, heappush
import bisect
from math import inf
from itertools import groupby
from itertools import permutations as comb

def gcd(a, b):
	while b:
		a %= b
		tmp = a
		a = b
		b = tmp
	return a

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

def check_prime(n):
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def nCr(n, r):
	return fact(n) // (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res

def primefactors(n):
	num = 0
	while n % 2 == 0:
		num += 1
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			num += 1
			n = n // i
	if n > 2:
		num += 1
	return num

def ask(a):
	print('? {}'.format(a), flush=True)
	n = I()
	return n

def linear_sieve(n):
	is_composite = [False] * n
	prime = []
	for i in range(2, n):
		if not is_composite[i]:
			prime.append(i)
		for j in prime:
			is_composite[i * j] = True
			if i % prime == 0:
				break
	return prime

def dfs(i, p, d):
	(a, tmp) = (0, 0)
	for j in d[i]:
		if j != p:
			a += 1
			tmp += dfs(j, i)
	if a == 0:
		return 0
	return tmp / a + 1

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n // i
	if n > 2:
		l.append(n)
	return l
d = []
primes = []
prim = [0] * (10 ** 5 + 1)

def sieve(n):
	for i in range(n):
		d.append(i)
	for i in range(2, n):
		if d[i] == i:
			prim[i] = 1
			primes.append(i)
		j = 0
		while j < len(primes) and primes[j] <= d[i] and (primes[j] * i < n):
			d[i * primes[j]] = primes[j]
			j += 1

def primeFactors(n):
	factors = []
	while n != 1:
		factors.append(d[n])
		n //= d[n]
	return factors

def maxPrefix(s, t):
	count = 0
	for i in range(0, len(t)):
		if count == len(s):
			break
		if t[i] == s[count]:
			count = count + 1
	return count
sieve(10 ** 5)
t = I()
for _ in range(t):
	n = I()
	a = input()
	for i in range(1, min(int(a), 10 ** 5) + 1):
		if prim[i] == 0:
			tmp = maxPrefix(str(i), a)
			if tmp == len(str(i)):
				print(tmp)
				print(i)
				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')


for j in range(int(input())):
	k = int(input())
	n = list(input())
	flag = 0
	d = {}
	if '1' in n:
		print(1)
		print(1)
		continue
	if '4' in n:
		print(1)
		print(4)
		continue
	if '6' in n:
		print(1)
		print(6)
		continue
	if '8' in n:
		print(1)
		print(8)
		continue
	if '9' in n:
		print(1)
		print(9)
		continue
	for i in range(k):
		d[n[i]] = 0
		if n[i] == '2' and i != 0:
			print(2)
			print(n[0], '2', sep='')
			flag = 1
			break
		if n[i] == '5' and i != 0:
			print(2)
			print(n[0], '5', sep='')
			flag = 1
			break
	if flag == 1:
		continue
	for i in range(k):
		d[n[i]] += 1
		if d[n[i]] == 2:
			print(2)
			print(n[i], n[i], sep='')
			flag = 1
			break
	if flag == 1:
		continue
	print(2)
	print(n[0], '7', sep='')


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 i in range(t):
	k = int(input())
	n = input()
	if '1' in n or '4' in n or '6' in n or ('8' in n) or ('9' in n):
		print(1)
		if '1' in n:
			print(1)
		elif '4' in n:
			print(4)
		elif '6' in n:
			print(6)
		elif '8' in n:
			print(8)
		elif '9' in n:
			print(9)
	elif '2' in n[1:] or '5' in n[1:] or n.count('3') >= 2 or (n.count('7') >= 2):
		print(2)
		if '2' in n[1:]:
			print(n[0] + '2')
		elif '5' in n[1:]:
			print(n[0] + '5')
		elif n.count('3') >= 2:
			print('33')
		elif n.count('7') >= 2:
			print('77')
	elif n == '237' or n == '273' or n == '537' or (n == '573'):
		print(2)
		if n == '237' or n == '273':
			print(27)
		if n == '537' or n == '573':
			print(57)
	elif n == '27' or n == '57':
		print(2)
		print(n)


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


def isPrime(n):
	if i not in ('2', '3', '5', '7'):
		return 0
	else:
		return 1
t = int(input())
for i in range(t):
	n = int(input())
	num = input()
	num1 = set(num)
	for i in num1:
		if not isPrime(int(i)):
			print(1)
			print(i)
			break
	else:
		if int(num) % 2 == 0:
			print(2)
			print(num[n - 2:])
		elif '2' in num and num.index('2') != 0:
			print(2)
			c = num.index('2')
			print(num[c - 1:c + 1])
		elif '5' in num and num.index('5') != 0:
			print(2)
			c = num.index('5')
			print(num[c - 1:c + 1])
		elif num.count('2') >= 2:
			print(2)
			print(22)
		elif num.count('3') >= 2:
			print(2)
			print(33)
		elif num.count('5') >= 2:
			print(2)
			print(55)
		elif num.count('7') >= 2:
			print(2)
			print(77)
		else:
			l = []
			for i in num:
				if i != '3':
					l.append(i)
			c = 0
			print(2)
			for i in l:
				if c < 2:
					print(i, end='')
				else:
					break
			print()


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()


import sys

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

def maps():
	return [int(i) for i in input().split()]

def isprime(num):
	if num > 1:
		for i in range(2, int(num / 2) + 1):
			if num % i == 0:
				return True
		else:
			return False
	else:
		return False
from collections import defaultdict
for _ in range(*maps()):
	(k,) = maps()
	num = input()
	if '1' in num:
		print(1, 1, sep='\n')
		continue
	i = 10
	cnt = 9
	A = []
	while cnt:
		cnt -= 1
		A.append(i + 2)
		A.append(i + 5)
		A.append(i + 3)
		A.append(i + 4)
		A.append(i + 6)
		A.append(i + 7)
		A.append(i + 8)
		A.append(i + 9)
		A.append(i)
		i += 10
	A.append(4)
	A.append(6)
	A.append(8)
	A.append(9)
	A = [i for i in A if isprime(i)]
	d = defaultdict(int)
	for i in num:
		d[i] += 1
	A.sort(key=lambda x: len(str(x)))
	for i in A:
		i = str(i)
		if len(i) == 2:
			d[i[0]] -= 1
			d[i[1]] -= 1
			if d[i[0]] >= 0 and d[i[1]] >= 0:
				idx1 = num.index(i[0])
				idx2 = k - num[::-1].index(i[1]) - 1
				if idx1 < idx2:
					print(len(i), i, sep='\n')
					break
			d[i[0]] += 1
			d[i[1]] += 1
		elif len(i) == 1:
			d[i[0]] -= 1
			if d[i[0]] >= 0:
				print(1, i, sep='\n')
				break
			d[i[0]] += 1
	else:
		print(-1)


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


prime = ['2', '3', '5', '7']
non_prime = ['4', '6', '8', '9']
t = int(input())
for test in range(t):
	k = int(input())
	n = input()
	if '1' in n:
		print('1')
		print('1')
	elif '0' in n:
		print('2')
		print(f'{n[0]}0')
	else:
		all_prime = True
		for num in n:
			if num in non_prime:
				all_prime = False
				print('1')
				print(num)
				break
		if all_prime:
			if n.count('2') > 1:
				print('2')
				print('22')
			elif n.count('3') > 1:
				print('2')
				print('33')
			elif n.count('5') > 1:
				print('2')
				print('55')
			elif n.count('7') > 1:
				print('2')
				print('77')
			elif n.count('2') == 1 and n.index('2') != 0:
				print('2')
				print(f'{n[0]}2')
			elif n.count('5') == 1 and n.index('5') != 0:
				print('2')
				print(f'{n[0]}5')
			elif n.count('2') == 1 and '7' in n:
				print('2')
				print('27')
			elif n.count('5') == 1 and '7' in n:
				print('2')
				print('57')


for _t in range(int(input())):
	n = int(input())
	number = input()
	non_primes = ['1', '4', '6', '8', '9']
	primes = ['2', '3', '5', '7']
	if any([digit in non_primes for digit in number]):
		for non_prime in non_primes:
			if non_prime in number:
				x = non_prime
		ans = '1' + '\n' + x
	else:
		for prime in primes:
			if number.count(prime) > 1:
				ans = '2' + '\n' + prime * 2
				break
		else:
			if number[0] != '2' and '2' in number:
				ans = '2' + '\n' + number[0] + '2'
			elif number[0] != '5' and '5' in number:
				ans = '2' + '\n' + number[0] + '5'
			elif number[0] == '2':
				ans = '2' + '\n' + '27'
			else:
				ans = '2' + '\n' + '57'
	print(ans)


from collections import Counter
noTestCases = int(input())
numbers = []
for _ in range(noTestCases):
	blah = input()
	number = input()
	numbers.append(number)
for number in numbers:
	if len(number) == 1:
		print('1')
		print(number)
		continue
	if '1' in number:
		print('1')
		print('1')
	elif '4' in number:
		print('1')
		print('4')
	elif '6' in number:
		print('1')
		print('6')
	elif '8' in number:
		print('1')
		print('8')
	elif '9' in number:
		print('1')
		print('9')
	else:
		c = Counter(number)
		occ2 = c.get('2', 0)
		occ3 = c.get('3', 0)
		occ5 = c.get('5', 0)
		occ7 = c.get('7', 0)
		if occ2 >= 2:
			print('2')
			print('22')
		elif occ3 >= 2:
			print('2')
			print('33')
		elif occ5 >= 2:
			print('2')
			print('55')
		elif occ7 >= 2:
			print('2')
			print('77')
		else:
			index2 = number.find('2')
			index3 = number.find('3')
			index5 = number.find('5')
			index7 = number.find('7')
			if index2 > 0:
				print('2')
				print(number[0] + '2')
				continue
			if index5 > 0:
				print('2')
				print(number[0] + '5')
				continue
			if index7 > index2 and index2 != -1:
				print('2')
				print('27')
				continue
			if index2 > index7 and index7 != -1:
				print('2')
				print('72')
				continue
			if index5 > index3 and index3 != -1:
				print('2')
				print('35')
				continue
			if index7 > index5 and index5 != -1:
				print('2')
				print('57')
				continue
			if index2 > index3 and index3 != -1:
				print('2')
				print('32')
				continue
			print(len(number))
			print(number)
			continue


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)


def solve():
	safe_ind = 0
	a = ''
	for (i, el) in enumerate(n):
		if el in safe:
			ans = el
			safe_ind += 1
			break
		else:
			a += el
	if safe_ind == 1:
		return (1, int(ans))
	else:
		if a[0:2] in safe_2:
			ans_else = a[0:2]
		else:
			b1 = a[0] + a[2]
			b2 = a[1] + a[2]
			if b1 in safe_2:
				ans_else = b1
			elif b2 in safe_2:
				ans_else = b2
		return (2, int(ans_else))
safe = ['1', '4', '6', '8', '9']
safe_2 = ['22', '32', '52', '72', '33', '25', '35', '55', '75', '27', '57', '77']
t = int(input())
for cases in range(t):
	k = int(input())
	n = input()
	(eins, zwei) = solve()
	print(eins)
	print(zwei)


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 collections import defaultdict
import sys
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.buffer.readline())

def MI():
	return map(int, sys.stdin.buffer.readline().split())

def LI():
	return list(map(int, sys.stdin.buffer.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def BI():
	return sys.stdin.buffer.readline().rstrip()

def SI():
	return sys.stdin.buffer.readline().rstrip().decode()

def li():
	return [int(i) for i in input().split()]

def lli(rows):
	return [li() for _ in range(rows)]

def si():
	return input()

def ii():
	return int(input())

def ins():
	return input().split()

def solve():
	k = II()
	s = SI()
	d = defaultdict(int)
	app = map(str, [1, 4, 6, 8, 9])
	for a in app:
		if a in s:
			return '1' + '\n' + str(a)
	for i in range(len(s)):
		d[s[i]] += 1
		if d[s[i]] == 2:
			return '2\n' + s[i] * 2
	if d['2'] != 0 and s[0] != '2':
		return '2\n' + s[0] + '2'
	elif d['5'] != 0 and s[0] != '5':
		return '2\n' + s[0] + '5'
	elif s[0] == '2':
		return '2\n' + '27'
	elif s[0] == '5':
		return '2\n' + '57'

def main():
	for _ in range(II()):
		sys.stdout.write(str(solve()) + '\n')
main()


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()


prime = [False] * 100
for i in range(2, 100):
	prime[i] = True
	j = 2
	while j * j <= i:
		if i % j == 0:
			prime[i] = False
		j += 1
for _ in range(int(input())):
	l = int(input())
	num = input()
	found = False
	for n in num:
		if '1' is n or '4' is n or '6' is n or ('8' is n) or ('9' is n):
			print(f'1\n{n}')
			found = True
			break
	if found:
		continue
	for n in range(len(num)):
		for j in range(n + 1, len(num)):
			if not prime[int(num[n] + num[j])]:
				print(f'2\n{num[n] + num[j]}')
				found = True
				break
		if found:
			break


for _ in range(int(input())):
	input()
	s = input()
	d = [0] * 10
	fin = False
	for i in s:
		d[int(i)] += 1
	for i in [1, 4, 6, 8, 9]:
		if d[i]:
			print(1)
			print(i)
			fin = True
			break
	if fin:
		continue
	print(2)
	for i in [2, 3, 5, 7]:
		if d[i] > 1:
			print(i * 11)
			fin = True
			break
	if fin:
		continue
	for i in [2, 5]:
		if d[i]:
			k = s.rindex(str(i))
			if k > 0:
				print(s[k - 1:k + 1])
				fin = True
				break
	if fin:
		continue
	k = s.rindex('7')
	if '2' in s[:k]:
		print(27)
		continue
	if '5' in s[:k]:
		print(57)
		continue
	exit(-1)


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')


a = '2357'
l = ['22', '25', '27', '32', '33', '35', '52', '55', '57', '72', '75', '77']
t = int(input())
for _ in range(t):
	n = int(input())
	k = int(input())
	s = str(k)
	i = 0
	j = 0
	m = ''
	if s.count(a[0]) + s.count(a[1]) + s.count(a[2]) + s.count(a[3]) < n:
		for x in s:
			if x not in a:
				print(1)
				print(x)
				break
			else:
				pass
	else:
		for x in range(n):
			for i in range(x + 1, n):
				if s[x] + s[i] in l:
					m += s[x] + s[i]
					break
			if m != '':
				break
		print(2)
		print(m)


def is_pr(a):
	for i in range(2, int(a ** 0.5) + 1):
		if a % i == 0:
			return False
	return True
for _ in range(int(input())):
	n = int(input())
	s = input()
	if '1' in s:
		print(1)
		print(1)
	elif '4' in s:
		print(1)
		print(4)
	elif '6' in s:
		print(1)
		print(6)
	elif '8' in s:
		print(1)
		print(8)
	elif '9' in s:
		print(1)
		print(9)
	else:
		print(2)
		if len(s) > 4:
			if s.count('2') > 1:
				print(22)
			elif s.count('3') > 1:
				print(33)
			elif s.count('5') > 1:
				print(55)
			else:
				print(77)
		else:
			ans = -1
			for i in range(len(s)):
				for j in range(i):
					if not is_pr(int(s[j] + s[i])):
						ans = s[j] + s[i]
			print(ans)


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


t = int(input())
for tc in range(t):
	k = int(input())
	n = input()
	res = 0
	if k == 1:
		print(1)
		print(n)
		continue
	for i in range(k):
		if n[i] in ['1', '4', '6', '8', '9']:
			print(1)
			print(n[i])
			res = 1
			break
	if res == 1:
		continue
	for i in range(k - 1):
		if n[i] == '2':
			tmp = {'2', '7', '5'}
			rem = set(n[i + 1:])
			if rem.isdisjoint(tmp) == False:
				print(2)
				print('2' + rem.intersection(tmp).pop())
				break
		if n[i] == '3':
			tmp = {'2', '3', '5'}
			rem = set(n[i + 1:])
			if rem.isdisjoint(tmp) == False:
				print(2)
				print('3' + rem.intersection(tmp).pop())
				break
		if n[i] == '5':
			tmp = {'2', '5', '7'}
			rem = set(n[i + 1:])
			if rem.isdisjoint(tmp) == False:
				print(2)
				print('5' + rem.intersection(tmp).pop())
				break
		if n[i] == '7':
			tmp = {'2', '7', '5'}
			rem = set(n[i + 1:])
			if rem.isdisjoint(tmp) == False:
				print(2)
				print('7' + rem.intersection(tmp).pop())
				break