#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const double pi = acos(-1);
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int N = 2e5 + 5;
int n, m, idx;
char s[N], ans[N];
bool st[10];
set<int> all;
bool check(int x) {
  if (x == 2) return 0;
  for (int i = 2; i <= x / i; ++i)
    if (x % i == 0) return 1;
  return 0;
}
void dfs(int i, int sum) {
  if (i > n) {
    all.insert(sum);
    return;
  }
  ans[++idx] = s[i];
  dfs(i + 1, sum * 10 + s[i] - '0');
  --idx;
  dfs(i + 1, sum);
}
int main() {
  st[2] = st[3] = st[5] = st[7] = 1;
  int t;
  cin >> t;
  while (t--) {
    cin >> n >> s + 1;
    int cnt[10] = {0};
    idx = 0;
    for (int i = 1; i <= n; ++i) {
      if (!st[s[i] - '0']) {
        ans[++idx] = s[i];
        goto out;
      }
    }
    for (int i = 1; i <= n; ++i) {
      cnt[s[i] - '0']++;
      if (cnt[s[i] - '0'] > 1) {
        ans[++idx] = s[i];
        ans[++idx] = s[i];
        goto out;
      }
    }
    all.clear();
    dfs(1, 0);
    for (int i : all)
      if (check(i)) {
        int k = i;
        while (k) {
          ans[++idx] = k % 10 + '0';
          k /= 10;
        }
        reverse(ans + 1, ans + 1 + idx);
        break;
      }
  out:
    printf("%d\n", idx);
    for (int i = 1; i <= idx; ++i) printf("%c", ans[i]);
    puts("");
  }
  return 0;
}
