#include <bits/stdc++.h>
using namespace std;
bool checkC(int n) {
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) return 1;
  }
  return 0;
}
void per(string s, int i, int &num, string &ans) {
  if (i == s.length()) {
    if (num != 0 && checkC(num)) {
      int x = num;
      int d = 0;
      while (x != 0) {
        x /= 10;
        d++;
      }
      if (d > 0) {
        if (d < ans.length() || ans.length() == 0) ans = to_string(num);
      }
    }
  } else {
    int k = num;
    num = num * 10 + (s[i] - '0');
    per(s, i + 1, num, ans);
    num = k;
    per(s, i + 1, num, ans);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int test;
  cin >> test;
  while (test--) {
    int k;
    cin >> k;
    string s;
    cin >> s;
    vector<int> c(10, 0);
    int ans = -1;
    for (int i = 0; i < k; i++) {
      int vl = s[i] - '0';
      if (vl == 1 || vl == 4 || vl == 6 || vl == 8 || vl == 9) {
        ans = vl;
        break;
      }
      c[vl]++;
    }
    if (ans != -1) {
      cout << "1\n";
      cout << ans << "\n";
    } else {
      if (c[2] >= 2) {
        cout << "2\n";
        cout << "22\n";
      } else if (c[3] >= 2) {
        cout << "2\n";
        cout << "33\n";
      } else if (c[5] >= 2) {
        cout << "2\n";
        cout << "55\n";
      } else if (c[7] >= 2) {
        cout << "2\n";
        cout << "77\n";
      } else {
        string pa = "";
        int num = 0;
        per(s, 0, num, pa);
        cout << pa.length() << "\n";
        cout << pa << "\n";
      }
    }
  }
}
