program ABC089B
    implicit none
    integer(8)::N,i
    integer(8)::result=4
    integer(8),dimension(4)::C=0!P,W,G,Yの順で
    character(1),allocatable,dimension(:)::S
    read(5,*)N
    allocate(S(N))
    read(5,*)(S(i),i=1,N)

    do i=1,N
        if(S(i)=="P")then
            C(1)=C(1)+1
        else if(S(i)=="W")then
            C(2)=C(2)+1
        else if(S(i)=="G")then
            C(3)=C(3)+1
        else if(S(i)=="Y")then
            C(4)=C(4)+1
        end if
    end do

    do i=1,4
        if(C(i)==0)then
            result=result-1
            exit
        end if
    end do

    if(result==4)then
        print'(A)',"Four"
    else
        print'(A)',"Three"
    end if
end program ABC089B
; 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"

@_QFEc.0 = internal unnamed_addr global i64 0
@_QFEc.1 = internal unnamed_addr global i64 0
@_QFEc.2 = internal unnamed_addr global i64 0
@_QFEc.3 = internal unnamed_addr global i64 0
@_QFEresult = internal unnamed_addr global i64 4
@_QFEs.0 = internal unnamed_addr global ptr null
@_QQcl.fae5aafb6d93edcc0b4a77b9f23ed6f3 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6211/source.f\00"
@_QQcl.50 = linkonce constant [1 x i8] c"P"
@_QQcl.57 = linkonce constant [1 x i8] c"W"
@_QQcl.47 = linkonce constant [1 x i8] c"G"
@_QQcl.59 = linkonce constant [1 x i8] c"Y"
@_QQcl.284129 = linkonce constant [3 x i8] c"(A)"
@_QQcl.466F7572 = linkonce constant [4 x i8] c"Four"
@_QQcl.5468726565 = linkonce constant [5 x i8] c"Three"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i64, align 8
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 5, ptr nonnull @_QQcl.fae5aafb6d93edcc0b4a77b9f23ed6f3, i32 7)
  %3 = call i1 @_FortranAioInputInteger(ptr %2, ptr nonnull %1, i32 8)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %5 = load i64, ptr %1, align 8, !tbaa !3
  %6 = call i64 @llvm.smax.i64(i64 %5, i64 0)
  %7 = call ptr @malloc(i64 %6)
  store ptr %7, ptr @_QFEs.0, align 8, !tbaa !7
  %8 = call ptr @_FortranAioBeginExternalListInput(i32 5, ptr nonnull @_QQcl.fae5aafb6d93edcc0b4a77b9f23ed6f3, i32 9)
  %9 = load i64, ptr %1, align 8, !tbaa !3
  %10 = icmp sgt i64 %9, 0
  br i1 %10, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %11 = phi i64 [ %15, %.lr.ph ], [ 1, %0 ]
  %.unpack176 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %12 = add i64 %11, -1
  %13 = getelementptr [1 x i8], ptr %.unpack176, i64 %12
  %14 = call i1 @_FortranAioInputAscii(ptr %8, ptr %13, i64 1)
  %15 = add nuw i64 %11, 1
  %exitcond.not = icmp eq i64 %11, %9
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %16 = call i32 @_FortranAioEndIoStatement(ptr %8)
  %17 = load i64, ptr %1, align 8, !tbaa !3
  %18 = icmp sgt i64 %17, 0
  br i1 %18, label %.lr.ph189, label %.preheader

.preheader:                                       ; preds = %50, %._crit_edge
  %19 = load i64, ptr @_QFEc.0, align 8, !tbaa !3
  %20 = icmp eq i64 %19, 0
  %21 = load i64, ptr @_QFEc.1, align 8
  %22 = icmp eq i64 %21, 0
  %or.cond = select i1 %20, i1 true, i1 %22
  %23 = load i64, ptr @_QFEc.2, align 8
  %24 = icmp eq i64 %23, 0
  %or.cond196 = select i1 %or.cond, i1 true, i1 %24
  %25 = load i64, ptr @_QFEc.3, align 8
  %26 = icmp eq i64 %25, 0
  %or.cond198 = select i1 %or.cond196, i1 true, i1 %26
  %27 = load i64, ptr @_QFEresult, align 8, !tbaa !3
  br i1 %or.cond198, label %52, label %thread-pre-split

.lr.ph189:                                        ; preds = %._crit_edge, %50
  %28 = phi i64 [ %51, %50 ], [ 1, %._crit_edge ]
  %.unpack = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %29 = add i64 %28, -1
  %30 = getelementptr [1 x i8], ptr %.unpack, i64 %29
  %31 = call i32 @_FortranACharacterCompareScalar1(ptr %30, ptr nonnull @_QQcl.50, i64 1, i64 1)
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %.sink.split, label %33

33:                                               ; preds = %.lr.ph189
  %.unpack140 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %34 = add i64 %28, -1
  %35 = getelementptr [1 x i8], ptr %.unpack140, i64 %34
  %36 = call i32 @_FortranACharacterCompareScalar1(ptr %35, ptr nonnull @_QQcl.57, i64 1, i64 1)
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %.sink.split, label %38

38:                                               ; preds = %33
  %.unpack152 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %39 = add i64 %28, -1
  %40 = getelementptr [1 x i8], ptr %.unpack152, i64 %39
  %41 = call i32 @_FortranACharacterCompareScalar1(ptr %40, ptr nonnull @_QQcl.47, i64 1, i64 1)
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %.sink.split, label %43

43:                                               ; preds = %38
  %.unpack164 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %44 = add i64 %28, -1
  %45 = getelementptr [1 x i8], ptr %.unpack164, i64 %44
  %46 = call i32 @_FortranACharacterCompareScalar1(ptr %45, ptr nonnull @_QQcl.59, i64 1, i64 1)
  %47 = icmp eq i32 %46, 0
  br i1 %47, label %.sink.split, label %50

.sink.split:                                      ; preds = %43, %38, %33, %.lr.ph189
  %_QFEc.0.sink201 = phi ptr [ @_QFEc.0, %.lr.ph189 ], [ @_QFEc.1, %33 ], [ @_QFEc.2, %38 ], [ @_QFEc.3, %43 ]
  %48 = load i64, ptr %_QFEc.0.sink201, align 8, !tbaa !3
  %49 = add i64 %48, 1
  store i64 %49, ptr %_QFEc.0.sink201, align 8, !tbaa !3
  br label %50

50:                                               ; preds = %.sink.split, %43
  %51 = add nuw i64 %28, 1
  %exitcond192.not = icmp eq i64 %28, %17
  br i1 %exitcond192.not, label %.preheader, label %.lr.ph189

52:                                               ; preds = %.preheader
  %53 = add i64 %27, -1
  store i64 %53, ptr @_QFEresult, align 8, !tbaa !3
  br label %thread-pre-split

thread-pre-split:                                 ; preds = %.preheader, %52
  %54 = phi i64 [ %53, %52 ], [ %27, %.preheader ]
  %55 = icmp eq i64 %54, 4
  br i1 %55, label %56, label %59

56:                                               ; preds = %thread-pre-split
  %57 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.284129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.fae5aafb6d93edcc0b4a77b9f23ed6f3, i32 31)
  %58 = call i1 @_FortranAioOutputAscii(ptr %57, ptr nonnull @_QQcl.466F7572, i64 4)
  br label %62

59:                                               ; preds = %thread-pre-split
  %60 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.284129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.fae5aafb6d93edcc0b4a77b9f23ed6f3, i32 33)
  %61 = call i1 @_FortranAioOutputAscii(ptr %60, ptr nonnull @_QQcl.5468726565, i64 5)
  br label %62

62:                                               ; preds = %56, %59
  %.sink = phi ptr [ %57, %56 ], [ %60, %59 ]
  %63 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  ret void
}

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

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i1 @_FortranAioInputAscii(ptr, ptr, i64) 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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #1

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
