public static void main ( String [ ] args ) throws IOException {
  BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;
  PrintWriter pw = new PrintWriter ( System . out ) ;
  int t = Integer . parseInt ( br . readLine ( ) ) ;
  int rows [ ] = {
    1 , 2 , 3 , 4 , 6 , 12 };
    int cols [ ] = {
      12 , 6 , 4 , 3 , 2 , 1 };
      String ans [ ] = {
        " 1x12" , " 2x6" , " 3x4" , " 4x3" , " 6x2" , " 12x1" };
        for ( int i = 0 ;
        i < t ;
        i ++ ) {
          String s = br . readLine ( ) ;
          StringBuilder sb = new StringBuilder ( ) ;
          int ansCount = 0 ;
          for ( int j = 0 ;
          j < 6 ;
          j ++ ) {
            if ( isValid ( s , rows [ j ] , cols [ j ] ) ) {
              ansCount ++ ;
              sb . append ( ans [ j ] ) ;
            }
          }
          pw . print ( ansCount ) ;
          pw . println ( sb ) ;
        }
        pw . flush ( ) ;
        pw . close ( ) ;
      }
      
public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; int rows [ ] = { 1 , 2 , 3 , 4 , 6 , 12 } ; int cols [ ] = { 12 , 6 , 4 , 3 , 2 , 1 } ; String ans [ ] = { " ▁ 1x12" , " ▁ 2x6" , " ▁ 3x4" , " ▁ 4x3" , " ▁ 6x2" , " ▁ 12x1" } ; for ( int i = 0 ; i < t ; i ++ ) { String s = br . readLine ( ) ; StringBuilder sb = new StringBuilder ( ) ; int ansCount = 0 ; for ( int j = 0 ; j < 6 ; j ++ ) { if ( isValid ( s , rows [ j ] , cols [ j ] ) ) { ansCount ++ ; sb . append ( ans [ j ] ) ; } } pw . print ( ansCount ) ; pw . println ( sb ) ; } 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: (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_initializer (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_initializer (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_initializer (string_literal) (string_literal) (string_literal) (string_literal) (string_literal) (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: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (method_invocation name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (identifier)) (array_access array: (identifier) index: (identifier))))) consequence: (block (expression_statement (update_expression (identifier))) (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 (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))