#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll, ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define pdd pair<double, double>
#define f first
#define s second
#define MOD 1000000007
#define mkp make_pair
#define M_PI 3.14159265358979323846
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define LOR(i,l,r) for (ll i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)
#define LORD(i,r,l) for (ll i=r;i>=l;i--)
#define INF 1000000000
#define CL(x) memset(x,0,sizeof(x))
#define DEB(x) cout << #x << " : " << x << '\n'
#define ALL(x) x.begin(), x.end()
#define SZ(x) x.size()
#define UI(x) (int)(x-'A')
#define LI(x) (int)(x-'a')
typedef long long ll;

int N;

int que(int i)
{
    cout<<i<<'\n';
    string st;
    cin>>st;
    int res=(st[0]=='M')?2:(st[0]=='F')?1:0;
    return res;
}



int main()
{
    ios::sync_with_stdio(false);
    //cin.tie(0);

    cin>>N;
    int r;
    r = que(0);//1...N-1
    int A = r;
    if( A==0 )return 0;

    int B = 3-A;
    r = que(1);
    if( r!=B )return 0;
    r = que(N-1);
    if( r!=B )return 0;

    int L = 1, R = N-1;
    int rl, rr;
    int Bor = B;
    while( L+1<R )
    {
        int md = (L+R)/2;
        rl = que( md );
        if( rl==0 )return 0;
        rr = que( md+1 );
        if( rr==0 )return 0;

        int C = ( (md-L)%2 ) ? 3-Bor : Bor ;
        if( rl==C )//in the right
        {
            L=md+1;
        }
        else
        {
            R=md-1;
        }
    }

    return 0;
}
