implicit none integer(8) n,i,j character a*3 integer(8),allocatable :: x(:,:) integer(8),allocatable :: y(:) read(*,*) n allocate (x(1:n,4)) allocate (y(0:9)) y(0:9)=4 do i=1,n read(*,*) (x(i,j),j=1,4),a if (trim(a)=="YES") then y(x(i,1))=y(x(i,1))+1 y(x(i,2))=y(x(i,2))+1 y(x(i,3))=y(x(i,3))+1 y(x(i,4))=y(x(i,4))+1 else y(x(i,1))=y(x(i,1))-1 y(x(i,2))=y(x(i,2))-1 y(x(i,3))=y(x(i,3))-1 y(x(i,4))=y(x(i,4))-1 end if end do write(*,*) maxloc(y)-1 end