integer::N character(30),allocatable::A(:,:) character(30),parameter::nyanpass='nyanpass ' integer::renge=-1,i,j read *,N allocate(A(N,N)) read *,A do i=1,N do j=1,i-1 if(A(i,j).ne.nyanpass) goto 100 end do do j=i+1,N if(A(i,j).ne.nyanpass) goto 100 end do if(renge.ne.-1) then renge = -1 exit else renge = i end if 100 end do print '(i0)',renge end program