#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  string S;
  int a[N];
  for(int i=0;i<N;++i) {
    a[i] = 0;
  }
  int t;
  int k, x;
  for(int i=0;i<N;++i) {
    if(i==0) {
      if(N%2==0) {
        a[N/2-1] = 1;
        a[N/2] = 1;
        cout<<2<<" "<<N/2<<endl;
      }
      else {
        a[N/2] = 1;
        cout<<1<<" "<<N/2+1<<endl;
      }
    }
    else {
      int ans;
      bool two;
      for(int j=0;j<N;++j) {
        if(a[j]!=a[N-1-j]) {
          if(a[j]==0) {
            ans = j+1;
            if(a[j+1]!=a[N-2-j]) {
              a[j] = 1;
              a[j+1] = 1;
              two = true;
            }
            else {
              a[j] = 1;
              two = false;
            }
          }
          else {
            ans = N-j;
            if(a[j+1]!=a[N-2-j]) {
              a[N-1-j] = 1;
              a[N-2-j] = 1;
              ans = N-1-j;
              two = true;
            }
            else {
              a[N-1-j] = 1;
              two = false;
            }
          }
          break;
        }
      }
      if(two) {
        cout<<2<<" "<<ans<<endl;
      }
      else {
        cout<<1<<" "<<ans<<endl;
      }
    }
    cin>>t;
    if(t==0) return 0;
    if(t==0 || t==1 || t==2) return 0;
    cin>>k>>x;
    x--;
    for(int j=0;j<N;++j) {
      if(j==x) {
        if(k==1) a[x] = 1;
        else {
          a[x] = 1;
          a[x+1] = 1;
        }
        break;
      }
    }
  }
}