public static void main ( String [ ] args ) throws IOException {
  BufferedReader f = new BufferedReader ( new InputStreamReader ( System . in ) ) ;
  String line1 = f . readLine ( ) ;
  String line2 = f . readLine ( ) ;
  String line3 = f . readLine ( ) ;
  String line4 = f . readLine ( ) ;
  String input1 = ( line1 + line2 . charAt ( 1 ) + line2 . charAt ( 0 ) ) . replace ( "X" , "" ) ;
  String input2 = ( line3 + line4 . charAt ( 1 ) + line4 . charAt ( 0 ) ) . replace ( "X" , "" ) ;
  if ( ( input2 + input2 ) . contains ( input1 ) ) System . out . println ( "YES" ) ;
  else System . out . println ( "NO" ) ;
}

public static void main ( String [ ] args ) throws IOException { BufferedReader f = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line1 = f . readLine ( ) ; String line2 = f . readLine ( ) ; String line3 = f . readLine ( ) ; String line4 = f . readLine ( ) ; String input1 = ( line1 + line2 . charAt ( 1 ) + line2 . charAt ( 0 ) ) . replace ( " X " , " " ) ; String input2 = ( line3 + line4 . charAt ( 1 ) + line4 . charAt ( 0 ) ) . replace ( " X " , " " ) ; if ( ( input2 + input2 ) . contains ( input1 ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; }
(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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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: (method_invocation object: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) name: (identifier) arguments: (argument_list (string_literal) (string_literal))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) name: (identifier) arguments: (argument_list (string_literal) (string_literal))))) (if_statement condition: (parenthesized_expression (method_invocation object: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) name: (identifier) arguments: (argument_list (identifier)))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) alternative: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))))))