program prob6
    implicit none
    integer :: N
    logical :: b(2)
    logical :: bl, br, btmp
    logical :: c
    integer :: l, r, tmp
    integer :: i
    character(len=10) :: S
    

    read(*,*) N


    ! 1番目
    write(*,*) 0
    call flush(6)

    read(*,*) S
    if(trim(adjustl(S)) == "Vacant") then
        stop
    end if

    if(trim(adjustl(S)) == "Male") then
        b(1) = .true.
    else
        b(1) = .false.
    end if
    
    ! 2番目
    write(*,*) N/2
    call flush(6)

    read(*,*) S
    if(trim(adjustl(S)) == "Vacant") then
        stop
    end if

    if(trim(adjustl(S)) == "Male") then
        b(2) = .true.
    else
        b(2) = .false.
    end if

    if(mod(N/2, 2) == 1)then
        if(xor(b(1), b(2)) .eqv. .true.) then
            c = .false.
        else
            c = .true.
        end if
    else
        if(xor(b(1), b(2)) .eqv. .true.) then
            c = .true.
        else
            c = .false.
        end if
    end if

    if(c) then
        l = 0
        r = N/2
        bl = b(1)
        br = b(2)
    else
        l = N/2
        r = N
        bl = b(2)
        br = b(1)
    end if

    do i = 3, 20 
        ! 読み込み
        tmp = (l+r) / 2
        write(*,*) tmp
        call flush(6)
        read(*,*) S
        if(trim(adjustl(S)) == "Vacant") then
            stop
        end if
        if(trim(adjustl(S)) == "Male") then
            btmp = .true.
        else
            btmp = .false.
        end if

        if(mod(tmp - l, 2) == 1) then !間が奇数席
            if(xor(bl, btmp) .eqv. .true.) then
                r = tmp
                br = btmp
                cycle
            end if
        else
            if(xor(bl, btmp) .eqv. .false.) then
                r = tmp
                br = btmp
                cycle
            end if
        end if

        if(mod(r - tmp, 2) == 1) then !間が奇数席
            if(xor(br, btmp) .eqv. .true.) then
                l = tmp
                bl = btmp
                cycle
            end if
        else
            if(xor(br, btmp) .eqv. .false.) then
                l = tmp
                bl = btmp
                cycle
            end if
        end if
    end do



    stop
contains
end program prob6