#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  int N; cin >> N;
  if (N == 0) {
    cout << 0 << endl;
    return 0;
  }

  vector<int> vs;
  while (abs(N) > 0) {
    int r = abs(N) % 2;
    if (r == 1) N--;
    vs.push_back(r);
    N /= -2;
  }
  for (auto it = vs.rbegin(); it != vs.rend(); ++it) {
    cout << *it;
  }
  cout << endl;
}

#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<numeric>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin >> n;
  int q = 0;
  int cnt = 0;
  int left = 0, right = n;
  vector<int> es(n);
  while(true) {
    cout << q << endl;
    string tmp;
    cin >> tmp;
    if(tmp == "Vacant"){
      return 0;
    }else if(tmp =="Male"){
      if(cnt == 0) {
        for(int i = 0; i < n; i++){
          if(i % 2 == 0){
            es[i] = 0;
          }else{
            es[i] = 1;
          }
        }
      } else {
        if(es[q] == 0){
          left = q;
        } else {
          right = q;
        }
      }
    }else{
      if(cnt == 0) {
        for(int i = 0; i < n; i++){
          if(i % 2 == 0){
            es[i] = 1;
          }else{
            es[i] = 0;
          }
        }
      } else {
        if(es[q] == 1){
          left = q;
        } else {
          right = q;
        }
      }
    }
    q = (left + right) / 2;
    cnt++;
  }
  return 0;
}