public static void main ( String args [ ] ) {
  Scanner sc = new Scanner ( System . in ) ;
  String s = sc . next ( ) ;
  char x = s . charAt ( 0 ) ;
  char y = s . charAt ( 1 ) ;
  if ( x == 'a' && y == '2' || x == 'a' && y == '3' || x == 'a' && y == '4' || x == 'a' && y == '5' || x == 'a' && y == '6' || x == 'a' && y == '7' || x == 'h' && y == '2' || x == 'h' && y == '3' || x == 'h' && y == '4' || x == 'h' && y == '5' || x == 'h' && y == '6' || x == 'h' && y == '7' || x == 'b' && y == '1' || x == 'c' && y == '1' || x == 'd' && y == '1' || x == 'e' && y == '1' || x == 'f' && y == '1' || x == 'g' && y == '1' || x == 'b' && y == '8' || x == 'c' && y == '8' || x == 'd' && y == '8' || x == 'e' && y == '8' || x == 'f' && y == '8' || x == 'g' && y == '8' ) {
    System . out . println ( "5" ) ;
  }
  else if ( x == 'a' && y == '1' || x == 'h' && y == '1' || x == 'a' && y == '8' || x == 'h' && y == '8' ) {
    System . out . println ( "3" ) ;
  }
  else {
    System . out . println ( "8" ) ;
  }
}

public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char x = s . charAt ( 0 ) ; char y = s . charAt ( 1 ) ; if ( x == ' a ' && y == '2' || x == ' a ' && y == '3' || x == ' a ' && y == '4' || x == ' a ' && y == '5' || x == ' a ' && y == '6' || x == ' a ' && y == '7' || x == ' h ' && y == '2' || x == ' h ' && y == '3' || x == ' h ' && y == '4' || x == ' h ' && y == '5' || x == ' h ' && y == '6' || x == ' h ' && y == '7' || x == ' b ' && y == '1' || x == ' c ' && y == '1' || x == ' d ' && y == '1' || x == ' e ' && y == '1' || x == ' f ' && y == '1' || x == ' g ' && y == '1' || x == ' b ' && y == '8' || x == ' c ' && y == '8' || x == ' d ' && y == '8' || x == ' e ' && y == '8' || x == ' f ' && y == '8' || x == ' g ' && y == '8' ) { System . out . println ( "5" ) ; } else if ( x == ' a ' && y == '1' || x == ' h ' && y == '1' || x == ' a ' && y == '8' || x == ' h ' && y == '8' ) { System . out . println ( "3" ) ; } else { System . out . println ( "8" ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) 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: (type_identifier) 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 (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal))))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) right: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal))))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))))))))