public static void main ( String [ ] args ) throws Exception {
  String path = "D:\\C-small-1-attempt0" ;
  Scanner sc = new Scanner ( new File ( path + ".in" ) ) ;
  PrintWriter pw = new PrintWriter ( path + ".out" ) ;
  int testCases = sc . nextInt ( ) ;
  for ( int testCase = 1 ;
  testCase <= testCases ;
  testCase ++ ) {
    int R = sc . nextInt ( ) ;
    int N = sc . nextInt ( ) ;
    int M = sc . nextInt ( ) ;
    int K = sc . nextInt ( ) ;
    pw . println ( "Case #" + testCase + ":" ) ;
    for ( int i = 0 ;
    i < R ;
    i ++ ) {
      Set < Integer > s = new HashSet < Integer > ( ) ;
      for ( int j = 0 ;
      j < K ;
      j ++ ) {
        s . add ( sc . nextInt ( ) ) ;
      }
      int [ ] b = new int [ N + 1 ] ;
      Arrays . fill ( b , 2 ) ;
      while ( b [ N ] == 2 ) {
        Set < Integer > s1 = new HashSet < Integer > ( s ) ;
        for ( int mask = 0 ;
        mask < 1 << N ;
        mask ++ ) {
          int p = 1 ;
          for ( int j = 0 ;
          j < N ;
          j ++ ) {
            if ( ( mask & ( 1 << j ) ) != 0 ) {
              p *= b [ j ] ;
            }
          }
          s1 . remove ( p ) ;
        }
        if ( s1 . isEmpty ( ) ) {
          break ;
        }
        ++ b [ 0 ] ;
        for ( int j = 0 ;
        j < N ;
        j ++ ) {
          if ( b [ j ] > M ) {
            b [ j ] = 2 ;
            ++ b [ j + 1 ] ;
          }
        }
      }
      for ( int j = 0 ;
      j < N ;
      j ++ ) {
        pw . print ( b [ j ] ) ;
      }
      pw . println ( ) ;
      pw . flush ( ) ;
    }
  }
  pw . close ( ) ;
}

public static void main ( String [ ] args ) throws Exception { String path = " D : \\ C - small - 1 - attempt0" ; Scanner sc = new Scanner ( new File ( path + " . in " ) ) ; PrintWriter pw = new PrintWriter ( path + " . out " ) ; int testCases = sc . nextInt ( ) ; for ( int testCase = 1 ; testCase <= testCases ; testCase ++ ) { int R = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; pw . println ( " Case ▁ # " + testCase + " : " ) ; for ( int i = 0 ; i < R ; i ++ ) { Set < Integer > s = new HashSet < Integer > ( ) ; for ( int j = 0 ; j < K ; j ++ ) { s . add ( sc . nextInt ( ) ) ; } int [ ] b = new int [ N + 1 ] ; Arrays . fill ( b , 2 ) ; while ( b [ N ] == 2 ) { Set < Integer > s1 = new HashSet < Integer > ( s ) ; for ( int mask = 0 ; mask < 1 << N ; mask ++ ) { int p = 1 ; for ( int j = 0 ; j < N ; j ++ ) { if ( ( mask & ( 1 << j ) ) != 0 ) { p *= b [ j ] ; } } s1 . remove ( p ) ; } if ( s1 . isEmpty ( ) ) { break ; } ++ b [ 0 ] ; for ( int j = 0 ; j < N ; j ++ ) { if ( b [ j ] > M ) { b [ j ] = 2 ; ++ b [ j + 1 ] ; } } } for ( int j = 0 ; j < N ; j ++ ) { pw . print ( b [ j ] ) ; } pw . println ( ) ; pw . flush ( ) ; } } pw . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (string_literal))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (binary_expression left: (identifier) right: (string_literal)))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (binary_expression left: (identifier) right: (string_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (string_literal) right: (identifier)) right: (string_literal))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments (type_identifier))) arguments: (argument_list)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal)))) (while_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) body: (block (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments (type_identifier))) arguments: (argument_list (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (decimal_integer_literal) right: (identifier))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier))))) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) consequence: (block (break_statement))) (expression_statement (update_expression (array_access array: (identifier) index: (decimal_integer_literal)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) (expression_statement (update_expression (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))