#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int maxn = 1e5 + 10;
int n, m, t;
bool prime[maxn];
string s;
void solve() {
  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() {
  for (int i = 2; i <= 100; i++) {
    prime[i] = true;
    for (int j = 2; j * j <= i; j++) {
      if (i % j == 0) {
        prime[i] = false;
      }
    }
  }
  cin >> t;
  while (t--) {
    cin >> n;
    cin >> s;
    solve();
  }
  return 0;
}
