static void solve ( int tc ) throws Exception {
  n = in . nint ( ) ;
  m = in . nint ( ) ;
  boolean [ ] [ ] grid = new boolean [ n ] [ m ] ;
  boolean [ ] vis = new boolean [ n * m * 12 ] ;
  int spos = 0 , tpos = 0 ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    String s = in . nstr ( ) ;
    for ( int j = 0 ;
    j < m ;
    j ++ ) {
      if ( s . charAt ( j ) == 'S' ) spos = i * m + j ;
      if ( s . charAt ( j ) == 'T' ) tpos = i * m + j ;
      grid [ i ] [ j ] = ( s . charAt ( j ) != '*' ) ;
    }
  }
  int [ ] queue = new int [ 15000000 ] ;
  ;
}

static void solve ( int tc ) throws Exception { n = in . nint ( ) ; m = in . nint ( ) ; boolean [ ] [ ] grid = new boolean [ n ] [ m ] ; boolean [ ] vis = new boolean [ n * m * 12 ] ; int spos = 0 , tpos = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String s = in . nstr ( ) ; for ( int j = 0 ; j < m ; j ++ ) { if ( s . charAt ( j ) == ' S ' ) spos = i * m + j ; if ( s . charAt ( j ) == ' T ' ) tpos = i * m + j ; grid [ i ] [ j ] = ( s . charAt ( j ) != ' * ' ) ; } } int [ ] queue = new int [ 15000000 ] ; ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) (throws (type_identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (boolean_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (boolean_type) dimensions: (dimensions_expr (identifier)) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (array_type element: (boolean_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (boolean_type) dimensions: (dimensions_expr (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) 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 (local_variable_declaration type: (type_identifier) 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 (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_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 (decimal_integer_literal)))))))