public static void dfs ( int n , int x , int y , long res , int cnt , HashSet < Long > set ) {
  if ( res > n || ( res == 0 && cnt > 0 ) ) return ;
  if ( res > 0 ) set . add ( res ) ;
  dfs ( n , x , y , res * 10 + x , cnt + 1 , set ) ;
  dfs ( n , x , y , res * 10 + y , cnt + 1 , set ) ;
}

public static void dfs ( int n , int x , int y , long res , int cnt , HashSet < Long > set ) { if ( res > n || ( res == 0 && cnt > 0 ) ) return ; if ( res > 0 ) set . add ( res ) ; dfs ( n , x , y , res * 10 + x , cnt + 1 , set ) ; dfs ( n , x , y , res * 10 + y , cnt + 1 , set ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (generic_type (type_identifier) (type_arguments (type_identifier))) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))))) consequence: (return_statement)) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier)) (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier)))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier)) (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier))))))