public static void main ( String [ ] args ) throws IOException {
  Scanner scanner = new Scanner ( System . in ) ;
  int t = scanner . nextInt ( ) ;
  for ( int x = 1 ;
  x <= t ;
  ++ x ) {
    int b = scanner . nextInt ( ) ;
    long m = scanner . nextLong ( ) ;
    System . out . print ( "Case #" + x + ": " ) ;
    if ( m > Math . pow ( 2 , b - 2 ) ) {
      System . out . print ( "IMPOSSIBLE\n" ) ;
      continue ;
    }
    else System . out . print ( "POSSIBLE\n" ) ;
    int [ ] [ ] slides = new int [ b ] [ b ] ;
    for ( int i = 0 ;
    i < b ;
    ++ i ) {
      for ( int j = i + 1 ;
      j < b ;
      ++ j ) {
        slides [ i ] [ j ] = 1 ;
      }
    }
    String str = Long . toBinaryString ( m - 1 ) + "" ;
    if ( str . equals ( "0" ) ) str = "" ;
    while ( str . length ( ) < b - 1 ) {
      str = "0" + str ;
    }
    str += "1" ;
    System . out . println ( str ) ;
    for ( int i = 1 ;
    i < b ;
    ++ i ) {
      for ( int j = 0 ;
      j < b ;
      ++ j ) {
        System . out . print ( slides [ i ] [ j ] ) ;
      }
      System . out . print ( "\n" ) ;
    }
  }
}

public static void main ( String [ ] args ) throws IOException { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; for ( int x = 1 ; x <= t ; ++ x ) { int b = scanner . nextInt ( ) ; long m = scanner . nextLong ( ) ; System . out . print ( " Case ▁ # " + x + " : ▁ " ) ; if ( m > Math . pow ( 2 , b - 2 ) ) { System . out . print ( " IMPOSSIBLE \n " ) ; continue ; } else System . out . print ( " POSSIBLE \n " ) ; int [ ] [ ] slides = new int [ b ] [ b ] ; for ( int i = 0 ; i < b ; ++ i ) { for ( int j = i + 1 ; j < b ; ++ j ) { slides [ i ] [ j ] = 1 ; } } String str = Long . toBinaryString ( m - 1 ) + " " ; if ( str . equals ( "0" ) ) str = " " ; while ( str . length ( ) < b - 1 ) { str = "0" + str ; } str += "1" ; System . out . println ( str ) ; for ( int i = 1 ; i < b ; ++ i ) { for ( int j = 0 ; j < b ; ++ j ) { System . out . print ( slides [ i ] [ j ] ) ; } System . out . print ( " \n " ) ; } } }
(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 (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)))) (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)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (string_literal) right: (identifier)) right: (string_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (binary_expression left: (identifier) right: (decimal_integer_literal)))))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (continue_statement)) alternative: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) (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 (identifier)) dimensions: (dimensions_expr (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: (identifier)) update: (update_expression (identifier)) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (decimal_integer_literal))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (string_literal)))) (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (expression_statement (assignment_expression left: (identifier) right: (string_literal)))) (while_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (string_literal) right: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (string_literal))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (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: (identifier)) update: (update_expression (identifier)) body: (block (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: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))))))))