#include <bits/stdc++.h>
using namespace std;
int t, k, ans;
char s[55];
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &k);
    scanf("%s", s + 1);
    ans = 0;
    for (int i = 1; i <= k; i++) {
      int x = s[i] - '0';
      if (x != 2 && x != 3 && x != 5 && x != 7) {
        ans = x;
        break;
      }
    }
    if (ans) {
      printf("%d\n%d\n", 1, ans);
      continue;
    }
    for (int i = 1; i <= k; i++) {
      int x1 = s[i] - '0';
      for (int j = i + 1; j <= k; j++) {
        int x2 = s[j] - '0';
        if (!(x1 == 2 && x2 == 3) && !(x1 == 3 && x2 == 7) &&
            !(x1 == 5 && x2 == 3) && !(x1 == 7 && x2 == 3)) {
          ans = x1 * 10 + x2;
          break;
        }
      }
    }
    if (ans) {
      printf("%d\n%d\n", 2, ans);
      continue;
    }
    printf("%d\n%d\n", 2, (s[1] - '0') * 10 + s[2] - '0');
  }
  return 0;
}
