program main
  implicit none
  integer i, mae, ushiro
  character(4) S
  read(*, *) S
  mae = 0
  ushiro = 0
  if (S(1:1) == '0') then
    if (S(2:2) /= '0') then
      mae = 1
    endif
  else if (S(1:1) == '1') then
    if (S(2:2) == '0' .or. S(2:2) == '1' .or. S(2:2) == '2') then
      mae = 1
    endif
  end if
  
  if (S(3:3) == '0') then
    if (S(4:4) /= '0') then
      ushiro = 1
    endif
  else if (S(3:3) == '1') then
    if (S(4:4) == '0' .or. S(4:4) == '1' .or. S(4:4) == '2') then
      ushiro = 1
    endif
  end if

   
  if (mae == 1) then
    if (ushiro == 1) then
      write(*,'(A)') 'AMBIGUOUS'
    else
      write(*,'(A)') 'MMYY'
    end if
  else
    if (ushiro == 1) then
      write(*,'(A)') 'YYMM'
    else
      write(*,'(A)') 'NA'
    end if
  end if
          


end program main

; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QQcl.0e064cf877b2af95c9fdb6573799a756 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_4277/source.f\00"
@_QQcl.30 = linkonce constant [1 x i8] c"0"
@_QQcl.31 = linkonce constant [1 x i8] c"1"
@_QQcl.32 = linkonce constant [1 x i8] c"2"
@_QQcl.284129 = linkonce constant [3 x i8] c"(A)"
@_QQcl.414D424947554F5553 = linkonce constant [9 x i8] c"AMBIGUOUS"
@_QQcl.4D4D5959 = linkonce constant [4 x i8] c"MMYY"
@_QQcl.59594D4D = linkonce constant [4 x i8] c"YYMM"
@_QQcl.4E41 = linkonce constant [2 x i8] c"NA"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca [4 x i8], align 1
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.0e064cf877b2af95c9fdb6573799a756, i32 5)
  %3 = call i1 @_FortranAioInputAscii(ptr %2, ptr nonnull %1, i64 4)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %5 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %1, ptr nonnull @_QQcl.30, i64 1, i64 1)
  %6 = icmp eq i32 %5, 0
  br i1 %6, label %7, label %10

7:                                                ; preds = %0
  %8 = getelementptr inbounds [4 x [1 x i8]], ptr %1, i64 0, i64 1
  %9 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %8, ptr nonnull @_QQcl.30, i64 1, i64 1)
  %.not4 = icmp ne i32 %9, 0
  br label %23

10:                                               ; preds = %0
  %11 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %1, ptr nonnull @_QQcl.31, i64 1, i64 1)
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %13, label %23

13:                                               ; preds = %10
  %14 = getelementptr inbounds [4 x [1 x i8]], ptr %1, i64 0, i64 1
  %15 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %14, ptr nonnull @_QQcl.30, i64 1, i64 1)
  %16 = icmp eq i32 %15, 0
  %17 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %14, ptr nonnull @_QQcl.31, i64 1, i64 1)
  %18 = icmp eq i32 %17, 0
  %19 = or i1 %16, %18
  %20 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %14, ptr nonnull @_QQcl.32, i64 1, i64 1)
  %21 = icmp eq i32 %20, 0
  %22 = or i1 %19, %21
  br label %23

23:                                               ; preds = %13, %7, %10
  %24 = phi i1 [ false, %10 ], [ %.not4, %7 ], [ %22, %13 ]
  %25 = getelementptr inbounds [4 x [1 x i8]], ptr %1, i64 0, i64 2
  %26 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %25, ptr nonnull @_QQcl.30, i64 1, i64 1)
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %31

28:                                               ; preds = %23
  %29 = getelementptr inbounds [4 x [1 x i8]], ptr %1, i64 0, i64 3
  %30 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %29, ptr nonnull @_QQcl.30, i64 1, i64 1)
  %.not = icmp ne i32 %30, 0
  br label %44

31:                                               ; preds = %23
  %32 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %25, ptr nonnull @_QQcl.31, i64 1, i64 1)
  %33 = icmp eq i32 %32, 0
  br i1 %33, label %34, label %.thread

34:                                               ; preds = %31
  %35 = getelementptr inbounds [4 x [1 x i8]], ptr %1, i64 0, i64 3
  %36 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %35, ptr nonnull @_QQcl.30, i64 1, i64 1)
  %37 = icmp eq i32 %36, 0
  %38 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %35, ptr nonnull @_QQcl.31, i64 1, i64 1)
  %39 = icmp eq i32 %38, 0
  %40 = or i1 %37, %39
  %41 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %35, ptr nonnull @_QQcl.32, i64 1, i64 1)
  %42 = icmp eq i32 %41, 0
  %43 = or i1 %40, %42
  br label %44

44:                                               ; preds = %34, %28
  %45 = phi i1 [ %.not, %28 ], [ %43, %34 ]
  br i1 %24, label %46, label %52

.thread:                                          ; preds = %31
  br i1 %24, label %.thread8, label %.thread9

46:                                               ; preds = %44
  br i1 %45, label %47, label %.thread8

47:                                               ; preds = %46
  %48 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.284129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.0e064cf877b2af95c9fdb6573799a756, i32 31)
  %49 = call i1 @_FortranAioOutputAscii(ptr %48, ptr nonnull @_QQcl.414D424947554F5553, i64 9)
  br label %58

.thread8:                                         ; preds = %.thread, %46
  %50 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.284129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.0e064cf877b2af95c9fdb6573799a756, i32 33)
  %51 = call i1 @_FortranAioOutputAscii(ptr %50, ptr nonnull @_QQcl.4D4D5959, i64 4)
  br label %58

52:                                               ; preds = %44
  br i1 %45, label %53, label %.thread9

53:                                               ; preds = %52
  %54 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.284129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.0e064cf877b2af95c9fdb6573799a756, i32 37)
  %55 = call i1 @_FortranAioOutputAscii(ptr %54, ptr nonnull @_QQcl.59594D4D, i64 4)
  br label %58

.thread9:                                         ; preds = %.thread, %52
  %56 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.284129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.0e064cf877b2af95c9fdb6573799a756, i32 39)
  %57 = call i1 @_FortranAioOutputAscii(ptr %56, ptr nonnull @_QQcl.4E41, i64 2)
  br label %58

58:                                               ; preds = %47, %.thread8, %53, %.thread9
  %.sink = phi ptr [ %48, %47 ], [ %50, %.thread8 ], [ %54, %53 ], [ %56, %.thread9 ]
  %59 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  ret void
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputAscii(ptr, ptr, i64) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i32 @_FortranACharacterCompareScalar1(ptr, ptr, i64, i64) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputAscii(ptr, ptr, i64) local_unnamed_addr

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
