#include <bits/stdc++.h>
using namespace std;
struct debugger {
  static void call(string::iterator it, string::iterator ed) {}
  template <typename T, typename... aT>
  static void call(string::iterator it, string::iterator ed, T a, aT... rest) {
    string b;
    for (; *it != ','; ++it)
      if (*it != ' ') b += *it;
    cerr << b << " = " << a << " ";
    call(++it, ed, rest...);
  }
};
bool prime[100];
void seive() {
  for (int i = 2; i <= 100; i++) {
    if (prime[i] == 0) {
      for (int j = i * 2; j <= 100; j += i) {
        prime[j] = 1;
      }
    }
  }
}
void solve(int n, string s) {
  for (int i = 0; i < n; i++) {
    if (s[i] == '1' || s[i] == '4' || s[i] == '6' || s[i] == '8' ||
        s[i] == '9') {
      cout << 1 << endl;
      cout << s[i] << endl;
      return;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (prime[(s[i] - '0') * 10 + (s[j] - '0')]) {
        cout << 2 << endl;
        cout << s[i] << s[j] << endl;
        return;
      }
    }
  }
}
int main() {
  int tc;
  cin >> tc;
  seive();
  while (tc--) {
    int n;
    string s;
    cin >> n;
    cin >> s;
    solve(n, s);
  }
}
