      IDENTIFICATION DIVISION.
      PROGRAM-ID. 60A.
      DATA DIVISION.
      WORKING-STORAGE SECTION.
      01 INP PIC X(100).
      01 A. 
      	03 AN PIC X(1) OCCURS 10 TIMES.
      01 B. 
      	03 BN PIC X(1) OCCURS 10 TIMES.
      01 C. 
      	03 CN PIC X(1) OCCURS 10 TIMES.
      01 WKA  PIC X(1).
      01 WKB  PIC X(1).
      01 WKC  PIC X(1).
      01 IDX  PIC 9(2).

      PROCEDURE DIVISION.
      ACCEPT INP.
      UNSTRING INP DELIMITED BY " "
      INTO A B C.
      
      PERFORM VARYING IDX FROM 1 BY 1 UNTIL ( IDX > 10 ) OR ( AN(IDX) = SPACE )
      MOVE AN(IDX) TO WKA
      END-PERFORM.
      
      PERFORM VARYING IDX FROM 1 BY 1 UNTIL ( IDX > 10 ) OR ( BN(IDX) = SPACE )
      MOVE BN(IDX) TO WKB
      END-PERFORM.
      
      IF ( WKA = BN(1) ) AND ( WKB = CN(1) )
      	DISPLAY "YES"
      ELSE
      	DISPLAY "NO"      
      END-IF.
      
      STOP RUN.
      