#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long n) {
  if (n <= 1) return false;
  for (long long i = 2; i < n; i++)
    if (n % i == 0) return false;
  return true;
}
int main(void) {
  long long t;
  cin >> t;
  while (t--) {
    long long k, i, p = -1, j;
    cin >> k;
    string s;
    char x;
    cin >> s;
    for (i = 0; i < k; i++) {
      if (s[i] != '2' && s[i] != '3' && s[i] != '5' && s[i] != '7') {
        p = i;
        break;
      }
    }
    if (p >= 0) {
      cout << "1" << endl;
      cout << s[p] << endl;
    } else {
      if (k == 2) {
        cout << "2" << endl;
        cout << s << endl;
      } else {
        map<char, long long> m;
        p = -1;
        for (i = 0; i < k; i++) {
          m[s[i]]++;
          if (m[s[i]] == 2) {
            p = 1;
            x = s[i];
            break;
          }
        }
        if (p == 1) {
          cout << "2" << endl;
          cout << x << x << endl;
        } else {
          long long num;
          for (i = 0; i < k; i++) {
            for (j = i + 1; j < k; j++) {
              p = 0;
              string c = "";
              c += s[i];
              c += s[j];
              num = stoll(c);
              if (isPrime(num) == false) {
                p = 1;
                break;
              }
            }
            if (p == 1) break;
          }
          cout << "2" << endl;
          cout << num << endl;
        }
      }
    }
  }
}
