#include <bits/stdc++.h>
using namespace std;
const int N = 55;
const int S = 100;
bool p[S];
int n, a[N];
char s[N];
void init() {
  for (int i = 2; i < S; ++i) p[i] = true;
  for (int i = 2; i * i < S; ++i) {
    if (!p[i]) continue;
    for (int j = i * i; j < S; j += i) p[j] = false;
  }
}
void solve() {
  for (int i = 0; i < n; ++i)
    if (!p[a[i]]) {
      printf("1\n%d\n", a[i]);
      return;
    }
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j)
      if (!p[a[i] * 10 + a[j]]) {
        printf("2\n%d\n", a[i] * 10 + a[j]);
        return;
      }
  assert(0);
}
int main() {
  init();
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%d%s", &n, s);
    for (int i = 0; i < n; ++i) a[i] = s[i] - '0';
    solve();
  }
  return 0;
}
