#include <bits/stdc++.h>
using namespace std;
int countdigit(long n) { return floor(log10(n) + 1); }
const long long int N = 1e15 + 10;
const long long int M = 1e9 + 7;
bool isprime(char a) {
  if (a == '2' || a == '3' || a == '5' || a == '7') return true;
  return false;
}
bool isPrime(int n) {
  if (n <= 1) return false;
  for (int i = 2; i < n; i++)
    if (n % i == 0) return false;
  return true;
}
void code() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (isprime(s[i]) == false) {
      cout << 1 << "\n";
      cout << s[i];
      return;
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '2') cnt++;
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      string x = "";
      x += s[i];
      x += s[j];
      int y = stoi(x);
      if (isPrime(y) == false) {
        cout << 2 << "\n";
        cout << x;
        return;
      }
    }
  }
}
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    code();
    cout << "\n";
  }
}
