text: #include<bits/stdc++.h>
  
  #define LL long long
  
  #define PII pair<int, int>
  #define VI vector<int>
  #define PB push_back
  #define PQ priority_queue
  
  #define MP make_pair
  #define F first
  #define S second
  
  #define MOD 1000000007
  #define N6 1000006
  #define N5 100005
  #define N4 10004
  #define N3 1003
  
  #define PI 3.1415926535897932384626
  
  #define N N5
  
  #define clr(v, a) memset(v, a, sizeof(v))
  #define all(x) x.begin(),x.end()
  #define R(i, n) for(int i=0; i<n; i++)
  #define len(x) ((int)(x).size())
  
  #define bits(x) __builtin_popcount(x)
  #define bitsLL(x) __builtin_popcountll(x)
  
  #define zerosl(x) __builtin_clz(x)
  #define zerosr(x) __builtin_ctz(x)
  
  /*
  ⢸⣿⣿⣿⣿⠃⠄⢀⣴⡾⠃⠄⠄⠄⠄⠄⠈⠺⠟⠛⠛⠛⠛⠻⢿⣿⣿⣿⣿⣶⣤⡀⠄
  ⢸⣿⣿⣿⡟⢀⣴⣿⡿⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⣸⣿⣿⣿⣿⣿⣿⣿⣷
  ⢸⣿⣿⠟⣴⣿⡿⡟⡼⢹⣷⢲⡶⣖⣾⣶⢄⠄⠄⠄⠄⠄⢀⣼⣿⢿⣿⣿⣿⣿⣿⣿⣿
  ⢸⣿⢫⣾⣿⡟⣾⡸⢠⡿⢳⡿⠍⣼⣿⢏⣿⣷⢄⡀⠄⢠⣾⢻⣿⣸⣿⣿⣿⣿⣿⣿⣿
  ⡿⣡⣿⣿⡟⡼⡁⠁⣰⠂⡾⠉⢨⣿⠃⣿⡿⠍⣾⣟⢤⣿⢇⣿⢇⣿⣿⢿⣿⣿⣿⣿⣿
  ⣱⣿⣿⡟⡐⣰⣧⡷⣿⣴⣧⣤⣼⣯⢸⡿⠁⣰⠟⢀⣼⠏⣲⠏⢸⣿⡟⣿⣿⣿⣿⣿⣿
  ⣿⣿⡟⠁⠄⠟⣁⠄⢡⣿⣿⣿⣿⣿⣿⣦⣼⢟⢀⡼⠃⡹⠃⡀⢸⡿⢸⣿⣿⣿⣿⣿⡟
  ⣿⣿⠃⠄⢀⣾⠋⠓⢰⣿⣿⣿⣿⣿⣿⠿⣿⣿⣾⣅⢔⣕⡇⡇⡼⢁⣿⣿⣿⣿⣿⣿⢣
  ⣿⡟⠄⠄⣾⣇⠷⣢⣿⣿⣿⣿⣿⣿⣿⣭⣀⡈⠙⢿⣿⣿⡇⡧⢁⣾⣿⣿⣿⣿⣿⢏⣾
  ⣿⡇⠄⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢻⠇⠄⠄⢿⣿⡇⢡⣾⣿⣿⣿⣿⣿⣏⣼⣿
  ⣿⣷⢰⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⢰⣧⣀⡄⢀⠘⡿⣰⣿⣿⣿⣿⣿⣿⠟⣼⣿⣿
  ⢹⣿⢸⣿⣿⠟⠻⢿⣿⣿⣿⣿⣿⣿⣿⣶⣭⣉⣤⣿⢈⣼⣿⣿⣿⣿⣿⣿⠏⣾⣹⣿⣿
  ⢸⠇⡜⣿⡟⠄⠄⠄⠈⠙⣿⣿⣿⣿⣿⣿⣿⣿⠟⣱⣻⣿⣿⣿⣿⣿⠟⠁⢳⠃⣿⣿⣿
  ⠄⣰⡗⠹⣿⣄⠄⠄⠄⢀⣿⣿⣿⣿⣿⣿⠟⣅⣥⣿⣿⣿⣿⠿⠋⠄⠄⣾⡌⢠⣿⡿⠃
  ⠜⠋⢠⣷⢻⣿⣿⣶⣾⣿⣿⣿⣿⠿⣛⣥⣾⣿⠿⠟⠛⠉⠄⠄
  */
  
  using namespace std;
  
  int n, m, k, t = 1;
  string s;
  int d[ 10 ];
  
  LL solve(){
      cin >> n;
      cin >> s;
      R(i, 10) d[ i ] = 0;
      R(i, n){
        d[ s[ i ] - '0' ]++;
      }
  
      if( d[ 1 ] ){ cout << "1\n1" << endl; return 0; }
      if( d[ 4 ] ){ cout << "1\n4" << endl; return 0; }
      if( d[ 6 ] ){ cout << "1\n6" << endl; return 0; }
      if( d[ 8 ] ){ cout << "1\n8" << endl; return 0; }
      if( d[ 9 ] ){ cout << "1\n9" << endl; return 0; }
  
      R(i, 10){
        if( d[ i ] > 1 ){
          cout << 2 << endl;
          cout << i << i << endl;
          return 0;
        }
      }
  
      if( d[ 2 ] and d[ 5 ] ){
        cout << 2 << endl;
        R(i, len(s)){
          if( s[ i ] == '2' or s[ i ] == '5' )
            cout << s[ i ];
        } cout << endl;
        return 0;
      }
  
      if( d[ 2 ] and d[ 7 ] ){
        cout << 2 << endl;
        R(i, len(s)){
          if( s[ i ] == '2' or s[ i ] == '7' )
            cout << s[ i ];
        } cout << endl;
        return 0;
      }
  
      if( d[ 5 ] and d[ 7 ] ){
        cout << 2 << endl;
        R(i, len(s)){
          if( s[ i ] == '5' or s[ i ] == '7' )
            cout << s[ i ];
        } cout << endl;
        return 0;
      }
  
      cout << 2 << endl;
      cout << s << endl;
  
      return 0;
  }
  
  int main(){
  
      cin >> t;
    // while(t--) cout << solve() << endl;
      while(t--) solve();
  
  }
  