#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int a1 = 1, a2 = 1, l1 = n, l2 = n, v1, v2;
cout << "1 1" << endl; cin >> max1;
cout << "1 " << n << endl; cin >> min1;
cout << "2 1" << endl; cin >> max2;
cout << "2 " << n << endl; cin >> min2;
if(min1 > max2) {
if(n > k) {
cout << "1 " << k; cin >> k;
cout << "3 " << k;
return 0;
} else {
cout << "2 " << k-n; cin >> k;
cout << "3 " << k;
return 0;
}
} else if(min2 > max1) {
if(n > k) {
cout << "2 " << k; cin >> k;
cout << "3 " << k;
return 0;
} else {
cout << "1 " << k-n; cin >> k;
cout << "3 " << k;
return 0;
}
}
while(l1-a1 > 8 || l2-a2 > 8) {
int i1 = (a1+l1)/2, i2 = (a2+l2)/2;
cout << "1 " << i1 << endl; cin >> v1;
cout << "2 " << i2 << endl; cin >> v2;
if(i1 + i2 < k) {
if(v1 > v2) {
l2 = i2;
} else {
l1 = i1;
}
} else {
if(v1 > v2) {
a1 = i1;
} else {
a2 = i2;
}
}
//if(v1 > v2) {
// a1 = i1;
// l2 = i2;
//} else {
// a2 = i2;
// l1 = i1;
//}
}
vector<int> v;
for(int i=a1; i<=l1; i++) {
cout << "1 " << i << endl;
cin >> v1; v.push_back(v1);
}
for(int i=a2; i<=l2; i++) {
cout << "2 " << i << endl;
cin >> v2; v.push_back(v2);
}
sort(v.rbegin(), v.rend());
cout << "3 " << v[k - a1 - a2 + 1] << endl;
}