#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
const int mod = 1e9+7;
const int N = 1e5+5;

vector<ll> f(2*N, 1), inv_f(2*N, 1);
vector<int> seive(N, 0), cnt(N, 0), all_1(N, 1);

ll fast_pow(ll a, ll b){
    ll ans = 1;
    while(b){
        if(b&1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b /= 2;
    }
    return ans;
}

inline ll nCr(int n, int r){
    if(n < r) return 0;
    return (f[n] * ((inv_f[r] * inv_f[n-r]) % mod)) % mod;
}

// ways in which each of the 'k' has atleast 1 item
ll ways(ll n, ll k){
    if(n < k) return 0;
    // cout << n << " " << k << " " << nCr(n+k-1, k-1) << endl;
    n -= k;
    return nCr(n+k-1, k-1);
}

int main(){
    ios_base :: sync_with_stdio(0);
    cin.tie(0);

    for(int j = 1; j < N*2; j++) f[j] = (f[j-1] * j) % mod, inv_f[j] = fast_pow(f[j], mod-2);
    for(int j = 2; j < N; j += 2) seive[j] = 2;
    for(int j = 3; j*j < N; j += 2)
        if(!seive[j]) for(int k = j*j; k < N; k+=j+j) seive[k] = j;
    for(int j = 1; j < N; j++) if(!seive[j]) seive[j] = j;
    for(int j = 1; j < N; j++){
        int &c = cnt[j];
        int &fg = all_1[j];
        int x = j;
        while(x != 1) {
            c++;
            int c_cnt = 0;
            int cur = seive[x];
            while(x % cur == 0) x /= cur, c_cnt ++;
            if(c_cnt > 1) fg = 0;
        }
    }

    // cout << (f[5] * ((inv_f[3] * inv_f[2]) % mod)) %mod << " " << nCr(5, 2) << " " << nCr(9, 2) << endl;
    int t;
    cin >> t;
    while(t--){
        int n, k;
        cin >> n >> k;
        ll ans = 0;
        /*if(k == 1) {
            cout << ((n == 1)? 1: 0) << '\n';
            continue;
        }*/
        for(int j = 1; j*j <= n; j++){
            if(n % j == 0 && all_1[j]){
                int c = cnt[j];
                if(c % 2 == 0) ans = (ans + ways(n/j, k)) % mod;
                else ans = (ans - ways(n/j, k) + mod) % mod;

                if(n != j*j && all_1[n/j]){
                    int c = cnt[n/j];
                    if(c % 2 == 0) ans = (ans + ways(j, k)) % mod;
                    else ans = (ans - ways(j, k) + mod) % mod;
                }
                // cout << j << " " << cnt[j] << " " << n/j << " " << cnt[n/j] << endl;
            }
        }
        cout << ans << '\n';
    }
    // night dress
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
const int mod = 1e9+7;
const int N = 1e5+5;

vector<ll> f(2*N, 1), inv_f(2*N, 1);
vector<int> seive(N, 0), cnt(N, 0);

ll fast_pow(ll a, ll b){
    ll ans = 1;
    while(b){
        if(b&1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b /= 2;
    }
    return ans;
}

inline ll nCr(int n, int r){
    if(n < r) return 0;
    return (f[n] * ((inv_f[r] * inv_f[n-r]) % mod)) % mod;
}

// ways in which each of the 'k' has atleast 1 item
ll ways(ll n, ll k){
    if(n < k) return 0;
    // cout << n << " " << k << " " << nCr(n+k-1, k-1) << endl;
    n -= k;
    return nCr(n+k-1, k-1);
}

int main(){
    ios_base :: sync_with_stdio(0);
    cin.tie(0);

    for(int j = 1; j < N; j++) f[j] = (f[j-1] * j) % mod, inv_f[j] = fast_pow(f[j], mod-2);
    for(int j = 2; j < N; j += 2) seive[j] = 2;
    for(int j = 3; j*j < N; j += 2)
        if(!seive[j]) for(int k = j*j; k < N; k+=j+j) seive[k] = j;
    for(int j = 1; j < N; j++) if(!seive[j]) seive[j] = j;
    for(int j = 1; j < N; j++){
        int &c = cnt[j];
        int x = j;
        while(x != 1) {
            int cur = seive[x];
            while(x % cur == 0) x /= cur, c++;
        }
    }

    // cout << (f[5] * ((inv_f[3] * inv_f[2]) % mod)) %mod << " " << nCr(5, 2) << " " << nCr(9, 2) << endl;
    int t;
    cin >> t;
    while(t--){
        int n, k;
        cin >> n >> k;
        ll ans = 0;
        if(k == 1) {
            cout << ((n == 1)? 1: 0) << '\n';
            continue;
        }
        for(int j = 1; j*j <= n; j++){
            if(n % j == 0){
                int c = cnt[j];
                if(c % 2 == 0) ans = (ans + ways(n/j, k)) % mod;
                else ans = (ans - ways(n/j, k) + mod) % mod;

                if(n != j*j){
                    int c = cnt[n/j];
                    if(c % 2 == 0) ans = (ans + ways(j, k)) % mod;
                    else ans = (ans - ways(j, k) + mod) % mod;
                }
                // cout << j << " " << cnt[j] << " " << n/j << " " << cnt[n/j] << endl;
            }
        }
        cout << ans << '\n';
    }
    // night dress
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
const int mod = 1e9+7;
const int N = 1e5+5;

vector<ll> f(N, 1), inv_f(N, 1);
vector<int> seive(N, 0), cnt(N, 0);

ll fast_pow(ll a, ll b){
    ll ans = 1;
    while(b){
        if(b&1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b /= 2;
    }
    return ans;
}

inline ll nCr(int n, int r){
    if(n < r) return 0;
    return (f[n] * ((inv_f[r] * inv_f[n-r]) % mod)) % mod;
}

// ways in which each of the 'k' has atleast 1 item
ll ways(ll n, ll k){
    if(n < k) return 0;
    // cout << n << " " << k << " " << nCr(n+k-1, k-1) << endl;
    n -= k;
    return nCr(n+k-1, k-1);
}

int main(){
    ios_base :: sync_with_stdio(0);
    cin.tie(0);

    for(int j = 1; j < N; j++) f[j] = (f[j-1] * j) % mod, inv_f[j] = fast_pow(f[j], mod-2);
    for(int j = 2; j < N; j += 2) seive[j] = 2;
    for(int j = 3; j*j < N; j += 2)
        if(!seive[j]) for(int k = j*j; k < N; k+=j+j) seive[k] = j;
    for(int j = 1; j < N; j++) if(!seive[j]) seive[j] = j;
    for(int j = 1; j < N; j++){
        int &c = cnt[j];
        int x = j;
        while(x != 1) {
            c++;
            int cur = seive[x];
            while(x % cur == 0) x /= cur;
        }
    }

    // cout << (f[5] * ((inv_f[3] * inv_f[2]) % mod)) %mod << " " << nCr(5, 2) << " " << nCr(9, 2) << endl;
    int t;
    cin >> t;
    while(t--){
        int n, k;
        cin >> n >> k;
        ll ans = 0;
        for(int j = 1; j*j <= n; j++){
            if(n % j == 0){
                int c = cnt[j];
                if(c % 2 == 0) ans = (ans + ways(n/j, k)) % mod;
                else ans = (ans - ways(n/j, k) + mod) % mod;

                if(n != j*j){
                    int c = cnt[n/j];
                    if(c % 2 == 0) ans = (ans + ways(j, k)) % mod;
                    else ans = (ans - ways(j, k) + mod) % mod;
                }
                // cout << j << " " << cnt[j] << " " << n/j << " " << cnt[n/j] << endl;
            }
        }
        cout << ans << '\n';
    }
    // night dress
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
#define mp make_pair
#define pb push_back

const int mod = 1e9+7;

const int N = 1e5 + 5;

ll fact[N], inv[N], cnt_f[N];
vector<int> f[N];

ll fast_pow(ll a, ll b){
    ll ans = 1;
    while(b > 0){
        if(b&1) ans = (ans*a) % mod;
        a = (a * a) % mod;
        b /= 2;
    }
    return ans;
}

void build(){
    fact[0] = inv[0] = 1;
    for(int j = 1; j < N; j++) fact[j] = (fact[j-1]*j) % mod, inv[j] = fast_pow(fact[j], mod-2);

    //seive part
    vector<int> seive(N, 0);
    for(int j = 4; j < N; j+=2) seive[j] = 2;
    for(int j = 3; j*j < N; j+=2)
        if(!seive[j]) for(int k = j*j; k < N; k+=j+j) seive[k] = j;
    for(int j = 0; j < N; j++) if(!seive[j]) seive[j] = j;

    for(int j = 1; j < N; j++){
        ll &cnt = cnt_f[j];
        cnt = 0;
        int x = j;
        while(x != 1){
            int cur = seive[x];
            f[j].pb(cur);
            while(x % cur == 0) x /= cur;
            cnt++;
        }
    }
}

ll nCr(int n, int r){
    return ((fact[n]*inv[r]) % mod * inv[n - r]) % mod;
}

ll solve(ll n, ll k){
    if(n < k) return 0;

    ll r_ans = 0;
    const vector<int>& v = f[n];
    int t = 1 << cnt_f[n];

    for(int j = 1; j < t; j++){
        int cnt = 0;
        ll cur = 1;
        for(int i = 0; i < cnt_f[n]; i++)
            if(j & (1 << i)) cnt++, cur *= v[i];

        int parts = n/cur;
        if(parts < k) continue;
        parts -= k;

        ll ways = nCr(parts + k - 1, k-1);
        if(cnt % 2) r_ans = (r_ans + ways) % mod;
        else r_ans = (r_ans - ways + mod) % mod;
    }
    n -= k;
    ll ans = (nCr(n+k-1, k-1) - r_ans + mod) % mod;
    return ans;
}

int main(){
    ios_base :: sync_with_stdio(0);
    cin.tie(0);

    build();
    int t;
    cin >> t;
    while(t--){
        int n, f;
        cin >> n >> f;
        cout << solve(n, f) << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
const int mod = 1e9+7;
const int N = 1e5+5;

vector<ll> f(2*N, 1), inv_f(2*N, 1);
vector<int> seive(N, 0), cnt(N, 0);

ll fast_pow(ll a, ll b){
    ll ans = 1;
    while(b){
        if(b&1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b /= 2;
    }
    return ans;
}

inline ll nCr(int n, int r){
    if(n < r) return 0;
    return (f[n] * ((inv_f[r] * inv_f[n-r]) % mod)) % mod;
}

// ways in which each of the 'k' has atleast 1 item
ll ways(ll n, ll k){
    if(n < k) return 0;
    // cout << n << " " << k << " " << nCr(n+k-1, k-1) << endl;
    n -= k;
    return nCr(n+k-1, k-1);
}

int main(){
    ios_base :: sync_with_stdio(0);
    cin.tie(0);

    for(int j = 1; j < N; j++) f[j] = (f[j-1] * j) % mod, inv_f[j] = fast_pow(f[j], mod-2);
    for(int j = 2; j < N; j += 2) seive[j] = 2;
    for(int j = 3; j*j < N; j += 2)
        if(!seive[j]) for(int k = j*j; k < N; k+=j+j) seive[k] = j;
    for(int j = 1; j < N; j++) if(!seive[j]) seive[j] = j;
    for(int j = 1; j < N; j++){
        int &c = cnt[j];
        int x = j;
        while(x != 1) {
            int cur = seive[x];
            while(x % cur == 0) x /= cur, c++;
        }
    }

    // cout << (f[5] * ((inv_f[3] * inv_f[2]) % mod)) %mod << " " << nCr(5, 2) << " " << nCr(9, 2) << endl;
    int t;
    cin >> t;
    while(t--){
        int n, k;
        cin >> n >> k;
        ll ans = 0;
        if(k == 1) {
            cout << 0 << '\n';
            continue;
        }
        for(int j = 1; j*j <= n; j++){
            if(n % j == 0){
                int c = cnt[j];
                if(c % 2 == 0) ans = (ans + ways(n/j, k)) % mod;
                else ans = (ans - ways(n/j, k) + mod) % mod;

                if(n != j*j){
                    int c = cnt[n/j];
                    if(c % 2 == 0) ans = (ans + ways(j, k)) % mod;
                    else ans = (ans - ways(j, k) + mod) % mod;
                }
                // cout << j << " " << cnt[j] << " " << n/j << " " << cnt[n/j] << endl;
            }
        }
        cout << ans << '\n';
    }
    // night dress
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
const int mod = 1e9+7;
const int N = 1e5+5;

vector<ll> f(2*N, 1), inv_f(2*N, 1);
vector<int> seive(N, 0), cnt(N, 0);

ll fast_pow(ll a, ll b){
    ll ans = 1;
    while(b){
        if(b&1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b /= 2;
    }
    return ans;
}

inline ll nCr(int n, int r){
    if(n < r) return 0;
    return (f[n] * ((inv_f[r] * inv_f[n-r]) % mod)) % mod;
}

// ways in which each of the 'k' has atleast 1 item
ll ways(ll n, ll k){
    if(n < k) return 0;
    // cout << n << " " << k << " " << nCr(n+k-1, k-1) << endl;
    n -= k;
    return nCr(n+k-1, k-1);
}

int main(){
    ios_base :: sync_with_stdio(0);
    cin.tie(0);

    for(int j = 1; j < N; j++) f[j] = (f[j-1] * j) % mod, inv_f[j] = fast_pow(f[j], mod-2);
    for(int j = 2; j < N; j += 2) seive[j] = 2;
    for(int j = 3; j*j < N; j += 2)
        if(!seive[j]) for(int k = j*j; k < N; k+=j+j) seive[k] = j;
    for(int j = 1; j < N; j++) if(!seive[j]) seive[j] = j;
    for(int j = 1; j < N; j++){
        int &c = cnt[j];
        int x = j;
        while(x != 1) {
            c++;
            int cur = seive[x];
            while(x % cur == 0) x /= cur;
        }
    }

    // cout << (f[5] * ((inv_f[3] * inv_f[2]) % mod)) %mod << " " << nCr(5, 2) << " " << nCr(9, 2) << endl;
    int t;
    cin >> t;
    while(t--){
        int n, k;
        cin >> n >> k;
        ll ans = 0;
        for(int j = 1; j*j <= n; j++){
            if(n % j == 0){
                int c = cnt[j];
                if(c % 2 == 0) ans = (ans + ways(n/j, k)) % mod;
                else ans = (ans - ways(n/j, k) + mod) % mod;

                if(n != j*j){
                    int c = cnt[n/j];
                    if(c % 2 == 0) ans = (ans + ways(j, k)) % mod;
                    else ans = (ans - ways(j, k) + mod) % mod;
                }
                // cout << j << " " << cnt[j] << " " << n/j << " " << cnt[n/j] << endl;
            }
        }
        cout << ans << '\n';
    }
    // night dress
    return 0;
}


/*
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,fma,tune=native")
//*/
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn  = 3e6;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);

#define pb push_back
//#define endl '\n'
#define dokme(x) return(cout << x , 0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ms(x , y) memset(x , y , sizeof x);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}

int n , k;

int ask(int x , int y){
    cout << 1 << ' ' << x << ' ' << y << endl;
    string ans;
    cin >> ans;
    return(ans == "TAK"); // nazdik mosavi L bood 1 mide
}

int find(int l , int r){
    while(r - l > 0){
        int mid = (l+r)/2;
        if(ask(mid , mid+1)){
            r = mid;
        }
        else{
            l = mid+1;
        }
    }
    return(l);
}

int main(){
    migmig
    cin >> n >> k;
    int ans1 = find(1 , n);
    int ans2 = find(1 , ans1 - 1);
    if(!ask(ans2,ans1))
        ans2 = find(ans1+1 , n);
    cout << 2 << ' ' << ans1 << ' ' << ans2;
    return(0);
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define popCnt(x) (__builtin_popcountll(x))
typedef unsigned long long Long;

const int N = 1e5 + 5;

bool ask(int x, int y) {
  cout << 1 << " " << x << " " << y << endl;
  string res;
  cin >> res;
  return res[0] == 'T';
}

int solve(int l, int r) {
  if (r < l) return 1;
  if (l == r) return l;
  int x = (l + r) / 2;
  int y = (l + r + 1) / 2;

  if (x == y) {
    ++y;
  }

  if (ask(x, y)) {
    return solve(l, x);
  }

  return solve(y, r);
}

int n;
bool valid(int x) {
  if (x != n && !ask(x, x + 1)) {
    return false;
  }
  if (x != 1 && !ask(x, x - 1)) {
    return false;
  }
  return true;
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef Local
//  freopen("test.in", "r", stdin);
#else
#define endl '\n'
#endif

  int k;
  cin >> n >> k;

  int a = solve(1, n);
  int b = solve(a + 1, n);
  int c = solve(1, a - 1);

  if (valid(b)) {
    cout << 2 << " " << a << " " << b << endl;
  } else {
    cout << 2 << " " << a << " " << c << endl;
  }

}


#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FRE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define int long long
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
#define endl "\n"
const int oo = INT_MAX;
const int MOD = 1e9 + 7;
const int sz = 1e5 + 5;
int n, k;
bool query(int i, int j) {
    printf("1 %lld %lld\n", i, j);
    fflush(stdout);
    string s; cin >> s;
    return (s == "TAK");
}

int32_t main() {
    IOS;
    int tc = 1;
    //cin >> tc;
    while(tc--) {
        cin >> n >> k;
        function<int(int, int)> bs = [=](int l, int r) {
            while(l < r) {
                int mid = l + (r - l) / 2;
                if(query(mid, mid + 1)) {
                    r = mid;
                } else l = mid + 1;
            }
            return l;
        };
        int ind1 = bs(1, n);
        int ind2 = bs(1, ind1 - 1);
        // checking if the second found index has an element or not
        if(!query(ind2, ind1))
            ind2 = bs(ind1 + 1, n);
        cout << "2 " << ind1 << " " << ind2 << endl;
        fflush(stdout);
    }
}


#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FRE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define int long long
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
#define endl "\n"
const int oo = INT_MAX;
const int MOD = 1e9 + 7;
const int sz = 1e5 + 5;
int n, k;
bool query(int i, int j) {
    if(i == -1 || y == -1) return false;
    printf("1 %lld %lld\n", i, j);
    fflush(stdout);
    string s; cin >> s;
    return (s == "TAK");
}

int32_t main() {
    IOS;
    int tc = 1;
    //cin >> tc;
    while(tc--) {
        cin >> n >> k;
        function<int(int, int)> bs = [=](int l, int r) {
            if (l > r) return -1ll;
            while(l < r) {
                int mid = l + (r - l) / 2;
                if(query(mid, mid + 1)) {
                    r = mid;
                } else l = mid + 1;
            }
            return l;
        };
        int ind1 = bs(1, n);
        int ind2 = bs(1, ind1 - 1);
        // checking if the second found index has an element or not
        if(!query(ind2, ind1))
            ind2 = bs(ind1 + 1, n);
        cout << "2 " << ind1 << " " << ind2 << endl;
        fflush(stdout);
    }
}


#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FRE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define int long long
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
#define endl "\n"
const int oo = INT_MAX;
const int MOD = 1e9 + 7;
const int sz = 1e5 + 5;
int n, k;
bool query(int i, int j) {
    if(i == -1 || j == -1) return false;
    printf("1 %lld %lld\n", i, j);
    fflush(stdout);
    string s; cin >> s;
    return (s == "TAK");
}

int32_t main() {
    IOS;
    int tc = 1;
    //cin >> tc;
    while(tc--) {
        cin >> n >> k;
        function<int(int, int)> bs = [=](int l, int r) {
            if (l > r) return -1ll;
            while(l < r) {
                int mid = l + (r - l) / 2;
                if(query(mid, mid + 1)) {
                    r = mid;
                } else l = mid + 1;
            }
            return l;
        };
        int ind1 = bs(1, n);
        int ind2 = bs(1, ind1 - 1);
        // checking if the second found index has an element or not
        if(!query(ind2, ind1))
            ind2 = bs(ind1 + 1, n);
        cout << "2 " << ind1 << " " << ind2 << endl;
        fflush(stdout);
    }
}


#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FRE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define int long long
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
#define endl "\n"
const int oo = INT_MAX;
const int MOD = 1e9 + 7;
const int sz = 1e5 + 5;
int n, k;
bool query(int i, int j) {
    printf("1 %lld %lld\n", i, j);
    fflush(stdout);
    string s; cin >> s;
    return (s == "TAK");
}

int32_t main() {
    IOS;
    int tc = 1;
    //cin >> tc;
    while(tc--) {
        cin >> n >> k;
        function<int(int, int)> bs = [=](int l, int r) {
            if (l > r) return -1ll;
            while(l < r) {
                int mid = l + (r - l) / 2;
                if(query(mid, mid + 1)) {
                    r = mid;
                } else l = mid + 1;
            }
            return l;
        };
        int ind1 = bs(1, n);
        int ind2 = bs(1, ind1 - 1);
        // checking if the second found index has an element or not
        if(!query(ind2, ind1))
            ind2 = bs(ind1 + 1, n);
        cout << "2 " << ind1 << " " << ind2 << endl;
        fflush(stdout);
    }
}

// https://codeforces.com/contest/429/problem/B
// https://codeforces.com/contest/809/problem/B
// https://codeforces.com/contest/621/problem/C
// https://codeforces.com/contest/1405/problem/E


#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FRE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define int long long
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
#define endl "\n"
const int oo = INT_MAX;
const int MOD = 1e9 + 7;
const int sz = 1e5 + 5;
int n, k;
bool query(int i, int j) {
    printf("1 %lld %lld\n", i, j);
    fflush(stdout);
    string s; cin >> s;
    return (s == "TAK");
}

int32_t main() {
    IOS;
    int tc = 1;
    //cin >> tc;
    while(tc--) {
        cin >> n >> k;
        function<int(int, int)> bs = [=](int l, int r) {
            if (l > r) return -1;
            while(l < r) {
                int mid = l + (r - l) / 2;
                if(query(mid, mid + 1)) {
                    r = mid;
                } else l = mid + 1;
            }
            return l;
        };
        int ind1 = bs(1, n);
        int ind2 = bs(1, ind1 - 1);
        // checking if the second found index has an element or not
        if(!query(ind2, ind1))
            ind2 = bs(ind1 + 1, n);
        cout << "2 " << ind1 << " " << ind2 << endl;
        fflush(stdout);
    }
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
int k,n;
char buf[10];
int ans;
int main()
{
	scanf("%d%d",&n,&k);
	int l=1,r=n;
	while(l<r)
	{
		int mid=(l+r)>>1;
		printf("1 %d %d\n",mid,mid+1);
		fflush(stdout);
		scanf("%s",buf);
		if(buf[0]=='T')r=mid;else l=mid+1;
	}
	ans=l;
	l=1;r=ans-1;
	while(l<r)
	{
		int mid=(l+r)>>1;
		printf("1 %d %d\n",mid,mid+1);
		fflush(stdout);
		scanf("%s",buf);
		if(buf[0]=='T')r=mid;else l=mid+1;
	}
	if(l==1)
	{
		if(ans!=1)
		{
			printf("1 1 2\n");
			fflush(stdout);
			scanf("%s",buf);
			if(buf[0]=='T')
			{
				printf("2 1 %d",ans);
				return 0;
			}
		}
	}
	else
	{
		bool ok=true;
		printf("1 %d %d\n",l-1,l);
		fflush(stdout);
		scanf("%s",buf);
		if(buf[0]=='T')ok=false;
		printf("1 %d %d\n",l,l+1);
		fflush(stdout);
		scanf("%s",buf);
		if(buf[0]=='N')ok=false;
		if(ok)
		{
			printf("2 %d %d",l,ans);
			return 0;
		}
	}
	l=ans+1;r=n;
	while(l<r)
	{
		int mid=(l+r)>>1;
		printf("1 %d %d\n",mid,mid+1);
		fflush(stdout);
		scanf("%s",buf);
		if(buf[0]=='T')r=mid;else l=mid+1;
	}
	printf("2 %d %d",ans,l);
	return 0;
}


    #include "bits/stdc++.h"
    using namespace std;

    #ifdef LOCAL
        #include "debug.h"
        #define input                         \
            freopen("input.txt", "r", stdin); \
            freopen("output.txt", "w", stdout);
    #else
        #define debug(...) 4
        #define input 4
    #endif

    using ll = long long;
    const int N = 2e5 + 5;
    const int mod = 1e9 + 7;

    inline int power(int x, int y, int res = 1) {
        for (; y; y >>= 1, x = 1ll * x * x % mod) {
            if (y & 1) { res = 1ll * res * x % mod; }
        } return res;
    }
    int query(int x, int y) {
        cout << "1 " << x << ' ' << y << endl;
        fflush(stdout);
        string s;
        cin >> s;
        if(s == "TAK")
            return 1;
        else
            return 0;
    }
    int32_t main() {
        input;
        // ios_base::sync_with_stdio(false);
        // cin.tie(NULL);

        int t = 1;
        // cin >> t;
        while(t--) {
            int n, k;
            cin >> n >> k;

            int l = 1, r = n + 1;
            while(l + 1 < r) {
                debug(l, r);
                int m = (l + r) / 2;
                int x = query(m - 1, m);
                if(x)
                    r = m;
                else
                    l = m;
            }
            int firstPoint = l;

            // 58 queries rem
            // either [1, firstPoint) or (firsPoint, n]

            l = 1, r = l;
            while(l + 1 < r) {
                int m = (l + r) / 2;
                int x = query(m - 1, m);
                if(x)
                    r = m;
                else
                    l = m;
            }
            debug(firstPoint);
            if(query(l, firstPoint) == 1) {
                cout << "2 " <<  min(l, firstPoint) << " " << max(l, firstPoint)  << endl;
                return 0;
            }
            l = firstPoint + 1, r = n + 1;
            while(l + 1 < r) {
                int m = (l + r) / 2;
                int x = query(m - 1, m);
                if(x)
                    r = m;
                else
                    l = m;
            }
            cout << "2 " <<  min(l, firstPoint) << " " << max(l, firstPoint)  << endl;

        }
    }


#include "bits/stdc++.h"
using namespace std;

#ifdef LOCAL
    #include "debug.h"
    #define input                         \
        freopen("input.txt", "r", stdin); \
        freopen("output.txt", "w", stdout);
#else
    #define debug(...) 4
    #define input 4
#endif

using ll = long long;
const int N = 2e5 + 5;
const int mod = 1e9 + 7;

inline int power(int x, int y, int res = 1) {
    for (; y; y >>= 1, x = 1ll * x * x % mod) {
        if (y & 1) { res = 1ll * res * x % mod; }
    } return res;
}
int query(int x, int y) {
    cout << "1 " << x << ' ' << y << ' ' << endl;
    string s;
    cin >> s;
    if(s == "TAK")
        return 1;
    else
        return 0;
}
int32_t main() {
    input;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    // cin >> t;
    while(t--) {
        int n, k;
        cin >> n >> k;

        int l = 1, r = n + 1;
        while(l + 1 < r) {
            debug(l, r);
            int m = (l + r) / 2;
            int x = query(m - 1, m);
            if(x)
                r = m;
            else
                l = m;
        }
        int firstPoint = l;

        // 58 queries rem
        // either [1, firstPoint) or (firsPoint, n]

        l = 1, r = l;
        while(l + 1 < r) {
            int m = (l + r) / 2;
            int x = query(m - 1, m);
            if(x)
                r = m;
            else
                l = m;
        }
        debug(firstPoint);
        if(query(l, firstPoint) == 1) {
            cout << "2 " <<  min(l, firstPoint) << " " << max(l, firstPoint)  << endl;
            return 0;
        }
        l = firstPoint + 1, r = n + 1;
        while(l + 1 < r) {
            int m = (l + r) / 2;
            int x = query(m - 1, m);
            if(x)
                r = m;
            else
                l = m;
        }
        cout << "2 " <<  min(l, firstPoint) << " " << max(l, firstPoint)  << endl;

    }
}


    #include "bits/stdc++.h"
    using namespace std;

    #ifdef LOCAL
        #include "debug.h"
        #define input                         \
            freopen("input.txt", "r", stdin); \
            freopen("output.txt", "w", stdout);
    #else
        #define debug(...) 4
        #define input 4
    #endif

    using ll = long long;
    const int N = 2e5 + 5;
    const int mod = 1e9 + 7;

    inline int power(int x, int y, int res = 1) {
        for (; y; y >>= 1, x = 1ll * x * x % mod) {
            if (y & 1) { res = 1ll * res * x % mod; }
        } return res;
    }
    int query(int x, int y) {
        cout << "1 " << x << ' ' << y << endl;
        fflush(stdout);
        string s;
        cin >> s;
        if(s == "TAK")
            return 1;
        else
            return 0;
    }
    int32_t main() {
        input;
        // ios_base::sync_with_stdio(false);
        // cin.tie(NULL);

        int t = 1;
        // cin >> t;
        while(t--) {
            int n, k;
            cin >> n >> k;

            int l = 1, r = n + 1;
            while(l + 1 < r) {
                // cout << l << " " << r << " ";
                int m = (l + r) / 2;
                int x = query(m - 1, m);
                if(x)
                    r = m;
                else
                    l = m;
            }
            int firstPoint = l;

            // 58 queries rem
            // either [1, firstPoint) or (firsPoint, n]
            if(l != 1) {
                l = 1, r = l;
                while(l + 1 < r) {
                    int m = (l + r) / 2;
                    int x = query(m - 1, m);
                    if(x)
                        r = m;
                    else
                        l = m;
                }
                debug(firstPoint);
                if(query(l, firstPoint) == 1) {
                    cout << "2 " <<  min(l, firstPoint) << " " << max(l, firstPoint)  << endl;
                    return 0;
                }
            }
            // cout << firstPoint << endl;
            l = firstPoint + 1, r = n + 1;
            while(l + 1 < r) {
                // cout << l << " " << r << endl;
                int m = (l + r) / 2;
                int x = query(m - 1, m);
                if(x)
                    r = m;
                else
                    l = m;
            }
            cout << "2 " <<  min(l, firstPoint) << " " << max(l, firstPoint)  << endl;

        }
    }


#include "bits/stdc++.h"
using namespace std;

#ifdef LOCAL
    #include "debug.h"
    #define input                         \
        freopen("input.txt", "r", stdin); \
        freopen("output.txt", "w", stdout);
#else
    #define debug(...) 4
    #define input 4
#endif

using ll = long long;
const int N = 2e5 + 5;
const int mod = 1e9 + 7;

inline int power(int x, int y, int res = 1) {
    for (; y; y >>= 1, x = 1ll * x * x % mod) {
        if (y & 1) { res = 1ll * res * x % mod; }
    } return res;
}
int query(int x, int y) {
    cout << "1 " << x << ' ' << y << ' ' << endl;
    fflush(stdout);
    string s;
    cin >> s;
    if(s == "TAK")
        return 1;
    else
        return 0;
}
int32_t main() {
    input;
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);

    int t = 1;
    // cin >> t;
    while(t--) {
        int n, k;
        cin >> n >> k;

        int l = 1, r = n + 1;
        while(l + 1 < r) {
            debug(l, r);
            int m = (l + r) / 2;
            int x = query(m - 1, m);
            if(x)
                r = m;
            else
                l = m;
        }
        int firstPoint = l;

        // 58 queries rem
        // either [1, firstPoint) or (firsPoint, n]

        l = 1, r = l;
        while(l + 1 < r) {
            int m = (l + r) / 2;
            int x = query(m - 1, m);
            if(x)
                r = m;
            else
                l = m;
        }
        debug(firstPoint);
        if(query(l, firstPoint) == 1) {
            cout << "2 " <<  min(l, firstPoint) << " " << max(l, firstPoint)  << endl;
            return 0;
        }
        l = firstPoint + 1, r = n + 1;
        while(l + 1 < r) {
            int m = (l + r) / 2;
            int x = query(m - 1, m);
            if(x)
                r = m;
            else
                l = m;
        }
        cout << "2 " <<  min(l, firstPoint) << " " << max(l, firstPoint)  << endl;

    }
}


#include "bits/stdc++.h"
using namespace std;

#ifdef LOCAL
    #include "debug.h"
    #define input                         \
        freopen("input.txt", "r", stdin); \
        freopen("output.txt", "w", stdout);
#else
    #define debug(...) 4
    #define input 4
#endif

using ll = long long;
const int N = 2e5 + 5;
const int mod = 1e9 + 7;

inline int power(int x, int y, int res = 1) {
    for (; y; y >>= 1, x = 1ll * x * x % mod) {
        if (y & 1) { res = 1ll * res * x % mod; }
    } return res;
}
int query(int x, int y) {
    cout << "1 " << x << ' ' << y << ' ' << endl;
    string s;
    cin >> s;
    if(s == "TAK")
        return 1;
    else
        return 0;
}
int32_t main() {
    input;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    // cin >> t;
    while(t--) {
        int n, k;
        cin >> n >> k;

        int l = 1, r = n + 1;
        while(l + 1 < r) {
            debug(l, r);
            int m = (l + r) / 2;
            int x = query(m - 1, m);
            if(x)
                r = m;
            else
                l = m;
        }
        int firstPoint = l;

        // 58 queries rem
        // either [1, firstPoint) or (firsPoint, n]

        l = 1, r = l;
        while(l + 1 < r) {
            int m = (l + r) / 2;
            int x = query(m - 1, m);
            if(x)
                r = m;
            else
                l = m;
        }
        debug(firstPoint);
        if(query(l, firstPoint) == 1) {
            cout << "2 " <<  l << " " << firstPoint  << endl;
            return 0;
        }
        l = firstPoint + 1, r = n + 1;
        while(l + 1 < r) {
            int m = (l + r) / 2;
            int x = query(m - 1, m);
            if(x)
                r = m;
            else
                l = m;
        }
        cout << "2 " <<  l << " " << firstPoint  << endl;

    }
}


#include "bits/stdc++.h"
using namespace std;

#ifdef LOCAL
    #include "debug.h"
    #define input                         \
        freopen("input.txt", "r", stdin); \
        freopen("output.txt", "w", stdout);
#else
    #define debug(...) 4
    #define input 4
#endif

using ll = long long;
const int N = 2e5 + 5;
const int mod = 1e9 + 7;

inline int power(int x, int y, int res = 1) {
    for (; y; y >>= 1, x = 1ll * x * x % mod) {
        if (y & 1) { res = 1ll * res * x % mod; }
    } return res;
}
int query(int x, int y) {
    cout << "1 " << x << ' ' << y << ' ' << endl;
    fflush(stdout);
    string s;
    cin >> s;
    if(s == "TAK")
        return 1;
    else
        return 0;
}
int32_t main() {
    input;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    // cin >> t;
    while(t--) {
        int n, k;
        cin >> n >> k;

        int l = 1, r = n + 1;
        while(l + 1 < r) {
            debug(l, r);
            int m = (l + r) / 2;
            int x = query(m - 1, m);
            if(x)
                r = m;
            else
                l = m;
        }
        int firstPoint = l;

        // 58 queries rem
        // either [1, firstPoint) or (firsPoint, n]

        l = 1, r = l;
        while(l + 1 < r) {
            int m = (l + r) / 2;
            int x = query(m - 1, m);
            if(x)
                r = m;
            else
                l = m;
        }
        debug(firstPoint);
        if(query(l, firstPoint) == 1) {
            cout << "2 " <<  min(l, firstPoint) << " " << max(l, firstPoint)  << endl;
            return 0;
        }
        l = firstPoint + 1, r = n + 1;
        while(l + 1 < r) {
            int m = (l + r) / 2;
            int x = query(m - 1, m);
            if(x)
                r = m;
            else
                l = m;
        }
        cout << "2 " <<  min(l, firstPoint) << " " << max(l, firstPoint)  << endl;

    }
}


#include "bits/stdc++.h"
using namespace std;

#ifdef LOCAL
    #include "debug.h"
    #define input                         \
        freopen("input.txt", "r", stdin); \
        freopen("output.txt", "w", stdout);
#else
    #define debug(...) 4
    #define input 4
#endif

using ll = long long;
const int N = 2e5 + 5;
const int mod = 1e9 + 7;

inline int power(int x, int y, int res = 1) {
    for (; y; y >>= 1, x = 1ll * x * x % mod) {
        if (y & 1) { res = 1ll * res * x % mod; }
    } return res;
}
int query(int x, int y) {
    cout << "1 " << x << ' ' << y << endl;
    fflush(stdout);
    string s;
    cin >> s;
    if(s == "TAK")
        return 1;
    else
        return 0;
}
int32_t main() {
    input;
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);

    int t = 1;
    // cin >> t;
    while(t--) {
        int n, k;
        cin >> n >> k;

        int l = 1, r = n + 1;
        while(l + 1 < r) {
            // cout << l << " " << r << " ";
            int m = (l + r) / 2;
            int x = query(m - 1, m);
            if(x)
                r = m;
            else
                l = m;
        }
        int firstPoint = l;

        // 58 queries rem
        // either [1, firstPoint) or (firsPoint, n]
        if(l != 1) {
            l = 1, r = l - 1;
            while(l < r) {
                int m = (l + r) / 2;
                int x = query(m, m + 1);
                if(x)
                    r = m;
                else
                    l = m + 1;
            }
            debug(firstPoint);
            if(query(l, firstPoint) == 1) {
                cout << "2 " <<  min(l, firstPoint) << " " << max(l, firstPoint)  << endl;
                return 0;
            }
        }
        // cout << firstPoint << endl;
        l = firstPoint + 1, r = n;
        while(l < r) {
            int m = (l + r) / 2;
            int x = query(m, m + 1);
            if(x)
                r = m;
            else
                l = m + 1;
        }
        cout << "2 " <<  min(l, firstPoint) << " " << max(l, firstPoint)  << endl;

    }
}


    #include "bits/stdc++.h"
    using namespace std;

    #ifdef LOCAL
        #include "debug.h"
        #define input                         \
            freopen("input.txt", "r", stdin); \
            freopen("output.txt", "w", stdout);
    #else
        #define debug(...) 4
        #define input 4
    #endif

    using ll = long long;
    const int N = 2e5 + 5;
    const int mod = 1e9 + 7;

    inline int power(int x, int y, int res = 1) {
        for (; y; y >>= 1, x = 1ll * x * x % mod) {
            if (y & 1) { res = 1ll * res * x % mod; }
        } return res;
    }
    int n;
    int query(int x, int y) {
        if(y > n)
            return 0;
        cout << "1 " << x << ' ' << y << endl;
        fflush(stdout);
        string s;
        cin >> s;
        if(s == "TAK")
            return 1;
        else
            return 0;
    }
    int32_t main() {
        input;
        // ios_base::sync_with_stdio(false);
        // cin.tie(NULL);

        int t = 1;
        // cin >> t;
        while(t--) {
            int k;
            cin >> n >> k;

            int l = 1, r = n + 1;
            while(l + 1 < r) {
                // cout << l << " " << r << " ";
                int m = (l + r) / 2;
                int x = query(m - 1, m);
                if(x)
                    r = m;
                else
                    l = m;
            }
            int firstPoint = l;

            // 58 queries rem
            // either [1, firstPoint) or (firsPoint, n]
            if(l != 1) {
                l = 1, r = l;
                while(l + 1 < r) {
                    int m = (l + r) / 2;
                    int x = query(m, m + 1);

                    if(x)
                        r = m;
                    else
                        l = m;
                }
                debug(firstPoint);
                if(query(l, firstPoint) == 1) {
                    cout << "2 " <<  min(l, firstPoint) << " " << max(l, firstPoint)  << endl;
                    return 0;
                }
            }
            // cout << firstPoint << endl;
            l = firstPoint + 1, r = n + 1;
            while(l + 1 < r) {
                // cout << l << " " << r << endl;
                int m = (l + r) / 2;
                int x = query(m, m + 1);
                if(x)
                    r = m;
                else
                    l = m;
            }
            cout << "2 " <<  min(l, firstPoint) << " " << max(l, firstPoint)  << endl;

        }
    }


// 809b.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <string>
using namespace std;

int n, k;

bool ask(int x, int y)
{
	cout << "1 " << x << ' ' << y << endl;
	string ans;
	cin >> ans;
	return ans.front() == 'T';
}

int bs(int l, int r)
{
	if (l == r)
	{
		return l;
	}
	int mid = (l + r) / 2;
	return ask(mid, mid + 1) ? bs(l, mid) : bs(mid + 1, r);
}

int main()
{
	cin >> n >> k;
	int firstdish = bs(1, n);
	if (firstdish == 1)
	{
		cout << "2 " << firstdish << ' ' << bs(2, n) << '\n';
		return 0;
	}
	int seconddish = bs(1, firstdish - 1);
	if (seconddish == firstdish - 1)
	{
		if (ask(firstdish - 1, firstdish) && ask(firstdish, firstdish - 1))
		{
			cout << "2 " << firstdish - 1 << ' ' << firstdish << '\n';
		}
		else
		{
			cout << "2 " << firstdish << ' ' << bs(firstdish + 1, n) << '\n';
		}
	}
	else
	{
		cout << "2 " << firstdish << ' ' << seconddish << '\n';
	}
}


#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cassert>
using namespace std;

#define sz(x) (int)(x.size())
#define rep(i,a,b) for(int i=a;i<b;++i)
#define pb push_back
//////////////
int const MAXQ = 60;

int n, k;
int ans1, ans2, ans3, cntq;

vector<int> p;

void addQ(){
	++cntq;
	assert(cntq <= MAXQ);
}

bool q(int x, int y){
	addQ();
	int dx = n;
	int dy = n;
	rep(i, 0, sz(p)){
		dx = min(dx, abs(x - p[i]));
		dy = min(dy, abs(y - p[i]));
	}
	return dx <= dy;
}

bool query(int x, int y){
#ifdef _DEBUG
	return q(x, y);
#endif
	cout << 1 << " " << x << " " << y << endl;
	fflush(stdout);
	string resp;
	cin >> resp;
	return resp == "TAK";
}

void answer(int x, int y){
#ifdef _DEBUG
	addQ();
#endif
	cout << 2 << " " << x << " " << y << endl;
	fflush(stdout);
	exit(0);
}

int findFirst(){
	int l = 1;
	int r = n;
	while(l<r){
		int m = (l+r)/2;
		if(query(m, m+1)){
			r = m;
		}else{
			l = m + 1;
		}
	}
	return l;
}

int findSecond(){
	if(ans1 == 1) return  -1;
	int l = 1;
	int r = ans1 - 1;
	while(l<r){
		int m = (l+r)/2;
		if(query(m, m+1)) r = m;
		else l = m + 1;
	}
	return l;
}

int findThird(){
	if(ans1 == n) return -1;
	int l = ans1 + 1;
	int r = n;
	while(l<r){
		int m = (l+r)/2;
		if(query(m+1, m)) l = m + 1;
		else r = m;
	}
	return l;
}

void solve(){
	cin >> n >> k;
#ifdef _DEBUG
	rep(i, 0, k){
		int pv;
		cin >> pv;
		p.pb(pv);
	}
#endif
	ans1 = findFirst();
	ans2 = findSecond();
	ans3 = findThird();
	if(ans2 == -1) swap(ans2, ans3);
	if(ans3 == -1) answer(ans1, ans2);
	if(query(ans3, ans2)) swap(ans2, ans3);
	answer(ans1, ans2);
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	solve();

	return 0;
}


#include <stdio.h>
#include <stdlib.h>

void ask(int a, int b) {
	printf("1 %d %d\n", a, b);
	fflush(stdout);
}

bool receive() {
	char str[4];
	scanf("%s", str);
	return str[0] == 'T';
}

void answer(int a, int b) {
	printf("2 %d %d\n", a, b);
	fflush(stdout);
	exit(0);
}

int main() {
	int n, k;
	scanf("%d %d", &n, &k);

	int first;

	int low = 1, high = n - 1;
	while (low < high) {
		int mid = (low + high) / 2;
		ask(mid, mid + 1);
		if (receive()) {
			high = mid;
		}
		else {
			low = mid + 1;
		}
	}
	first = high;

	low = first + 1;
	high = n;
	while (low < high) {
		int mid = (low + high) / 2;
		ask(mid, mid + 1);
		if (receive()) {
			high = mid;
		}
		else {
			low = mid + 1;
		}
	}
	if (low == first + 1) {
		ask(first + 1, first);
		if (receive()) {
			answer(first, first + 1);
		}
	}
	else {
		answer(first, low);
	}

	low = 1, high = first - 1;
	while (low < high) {
		int mid = (low + high) / 2;
		ask(mid, mid + 1);
		if (receive()) {
			high = mid;
		}
		else {
			low = mid + 1;
		}
	}
	answer(low, first);

	return 0;
}


#include <cstdio>
#include <vector>
#include <algorithm>
#include "memory.h"
#include <string>
#include <set>

using namespace std;

int n, k;

bool ask(int x, int y) {
	printf("1 %d %d\n", x, y);
	fflush(stdout);
	char ch;
	do { scanf("%c", &ch); } while ((ch != 'T') && (ch != 'N'));
	return (ch == 'T');
}

void ans(int x, int y) {
	printf("2 %d %d\n", x, y);
	fflush(stdout);
}

int main() {
	scanf("%d%d", &n, &k);
	int l = 1, r = n;
	while (l < r) {
		if (ask((l+r)/2, (l+r)/2+1)) r = (l+r)/2; else {
			bool b = ((l+r)%2 == 0);
			l = (l+r)/2+1;
			if (b) r++;
			if (r == n+1) r--;
		}
	}
	int k = l;
	if (k >= (n+1)/2) {
		if (ask(1, n)) {
			l = 1;
			r = k-1;
			while (l < r) {
				if (!ask((l+r-1)/2, (l+r-1)/2+1)) l = (l+r-1)/2+1; else {
					bool b = ((l+r)%2 == 0);
					r = (l+r-1)/2;
					if (b) l--;
					if (l == 0) l++;
				}
			}
			ans(l, k);
		} else {
			l = k+1;
			r = n;
			while (l < r) {
				if (ask((l+r)/2, (l+r)/2+1)) r = (l+r)/2; else {
					bool b = ((l+r)%2 == 0);
					l = (l+r)/2+1;
					if (b) r++;
					if (r == n+1) r--;
				}
			}
			ans(k, l);
		}
	}
    return 0;
}


#include <cstdio>
#include <vector>
#include <algorithm>
#include "memory.h"
#include <string>
#include <set>

using namespace std;

int n, k;

bool ask(int x, int y) {
	printf("1 %d %d\n", x, y);
	fflush(stdout);
	char ch;
	do { scanf("%c", &ch); } while ((ch != 'T') && (ch != 'N'));
	return (ch == 'T');
}

void ans(int x, int y) {
	printf("2 %d %d\n", x, y);
	fflush(stdout);
}

int main() {
	bool debug = false;
	scanf("%d%d", &n, &k);
	int l = 1, r = n;
	while (l < r) {
		if (ask((l+r)/2, (l+r)/2+1)) r = (l+r)/2; else {
			bool b = ((l+r)%2 == 0);
			l = (l+r)/2+1;
			if (b) r++;
			if (r == n+1) r--;
		}
	}
	if (debug) printf("k = %d\n", k);
	int k = l;
	if (k == 1) {
		l = 2;
		r = n;
		while (l < r) {
			if (ask((l+r)/2, (l+r)/2+1)) r = (l+r)/2; else {
				bool b = ((l+r)%2 == 0);
				l = (l+r)/2+1;
				if (b) r++;
				if (r == n+1) r--;
			}
		}
		ans(1, l);
	} else if (k == n) {
		l = 1;
		r = n-1;
		while (l < r) {
			if (!ask((l+r-1)/2, (l+r-1)/2+1)) l = (l+r-1)/2+1; else {
				bool b = ((l+r)%2 == 0);
				r = (l+r-1)/2;
				if (b) l--;
				if (l == 0) l++;
			}
		}
		ans(l, k);
	} else {
		l = 1;
		r = k-1;
		while (l < r) {
			if (!ask((l+r-1)/2, (l+r-1)/2+1)) l = (l+r-1)/2+1; else {
				bool b = ((l+r)%2 == 0);
				r = (l+r-1)/2;
				if (b) l--;
				if (l == 0) l++;
			}
		}
		if (ask(l, k)) ans(l, k); else {
			l = k+1;
			r = n;
			while (l < r) {
				if (ask((l+r)/2, (l+r)/2+1)) r = (l+r)/2; else {
					bool b = ((l+r)%2 == 0);
					l = (l+r)/2+1;
					if (b) r++;
					if (r == n+1) r--;
				}
			}
			ans(k, l);
		}
	}
    return 0;
}


#include <cstdio>
#include <iostream>
#include <string>

bool query(int a, int b)
{
    std::string s;
    std::cout << 1 << ' ' << a << ' ' << b << '\n';
    fflush(stdout);
    std::cin >> s;
    if (s == "TAK") //a is closer
        return true;
    else
        return false;
}

void answer(int x, int y)
{
    std::cout << 2 << ' ' << x << ' ' << y << '\n';
    fflush(stdout);
}

int main()
{
    int n, k;
    std::cin >> n >> k;
    if (k == n)
        answer(1, 2);
    else
    {
        //find the first one
        int lo = 1;
        int hi = n;
        int dish_1 = -1;
        int dish_2 = -1;
        while (lo+1 < hi)
        {
            int mid_l = (lo+hi)/2;
            int mid_r = mid_l + 1;
            if (query(mid_l, mid_r)) //move to left
                hi = mid_l;
            else //move to right
                lo = mid_r;
        }
        if (lo == hi)
            dish_1 = lo;
        else
        {
            if (query(lo, hi))
                dish_1 = lo;
            else
                dish_1 = hi;
        }
        //answer(dish_1, -1);
        if (dish_1 != 1) //try to find something on the left of dish_1
        {
            lo = 1;
            hi = dish_1-1;
            while (lo < hi)
            {
                int mid_l = (lo+hi)/2;
                int mid_r = mid_l + 1;
                if (query(mid_l, mid_r)) //move to left
                    hi = mid_l;
                else //move to right
                    lo = mid_r;
            }
            if (lo+1 == dish_1)
            {
                if (query(lo, dish_1))
                    dish_2 = lo;
                //otherwise FAIL; no dishes to the left of dish_1
            }
            else
                dish_2 = lo;
        }
        if (dish_2 == -1) //try to find something on the right of dish_1
        {
            lo = dish_1+1;
            hi = n;
            while (lo < hi)
            {
                int mid_l = (lo+hi)/2;
                int mid_r = mid_l + 1;
                if (query(mid_l, mid_r)) //move to left
                    hi = mid_l;
                else //move to right
                    lo = mid_r;
            }
            dish_2 = lo;
        }
        answer(dish_1, dish_2);
    }
}


#include <cstdio>
#include <iostream>
#include <string>

bool query(int a, int b)
{
    std::string s;
    std::cout << 1 << ' ' << a << ' ' << b << '\n';
    fflush(stdout);
    std::cin >> s;
    if (s == "YES") //a is closer
        return true;
    else
        return false;
}

void answer(int x, int y)
{
    std::cout << 2 << ' ' << x << ' ' << y << '\n';
    fflush(stdout);
}

int main()
{
    int n, k;
    std::cin >> n >> k;
    if (k == n)
        answer(1, 2);
    else
    {
        //find the first one
        int lo = 1;
        int hi = n;
        int dish_1 = -1;
        int dish_2 = -1;
        while (lo+1 < hi)
        {
            int mid_l = (lo+hi)/2;
            int mid_r = mid_l + 1;
            if (query(mid_l, mid_r)) //move to left
                hi = mid_l;
            else //move to right
                lo = mid_r;
        }
        if (lo == hi)
            dish_1 = lo;
        else
        {
            if (query(lo, hi))
                dish_1 = lo;
            else
                dish_1 = hi;
        }
        //answer(dish_1, -1);
        if (dish_1 != 1) //try to find something on the left of dish_1
        {
            lo = 1;
            hi = dish_1-1;
            while (lo < hi)
            {
                int mid_l = (lo+hi)/2;
                int mid_r = mid_l + 1;
                if (query(mid_l, mid_r)) //move to left
                    hi = mid_l;
                else //move to right
                    lo = mid_r;
            }
            if (lo+1 == dish_1)
            {
                if (query(lo, dish_1))
                    dish_2 = lo;
                //otherwise FAIL; no dishes to the left of dish_1
            }
            else
                dish_2 = lo;
        }
        if (dish_2 == -1) //try to find something on the right of dish_1
        {
            lo = dish_1+1;
            hi = n;
            while (lo < hi)
            {
                int mid_l = (lo+hi)/2;
                int mid_r = mid_l + 1;
                if (query(mid_l, mid_r)) //move to left
                    hi = mid_l;
                else //move to right
                    lo = mid_r;
            }
            dish_2 = lo;
        }
        answer(dish_1, dish_2);
    }
}


#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cwctype>
#include <functional>
using namespace std;

char s[10];
int n;

int query(int a, int b) {
	printf("1 %d %d\n", a, b);
	fflush(stdout);
	memset(s, 0, sizeof(s));
	scanf("%s\n", s);
	if (s[0] == 'T')
		return 0;
	else
		return 1;
}

pair<bool, int> getOne(int a, int b, int good) {
	int len = b - a + 1;
	while (len > 3) {
		int shift = len / 3;
		int first = a + shift;
		int second = b - shift;
		int res = query(first, second);
		int mid = len - 2 * (shift + 1);
		int midL = a + shift + (mid + 1) / 2;
		int midR = b - shift - (mid + 1) / 2;
		if (res == 0) {
			b = midL;
		} else {
			a = midR;
		}
	}

	if (a == b) {
		if (good == -1)
			throw 42;
		int res = query(a, good);
		if (res == 0)
			return make_pair(true, a);
		else
			return make_pair(false, a);
	}

	int cur = a;
	int ans;
	for (; cur <= b; ++cur) {
		bool goodCur = true;
		for (int i = cur + 1; i <= b; ++i) {
			int res = query(cur, i);
			if (res != 0) {
				goodCur = false;
				break;
			}
		}
		if (goodCur) {
			ans = cur;
			break;
		}
	}
	if (good == -1 || query(ans, good) == 0) {
		return make_pair(true, ans);
	} else {
		return make_pair(false, ans);
	}
}

int main () {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif

	scanf("%d%*d\n", &n);

	int a = getOne(1, n, -1).second;
	pair<bool, int> temp(false, 0);
	if (a != 1)
		temp = getOne(1, a - 1, a);
	if (!temp.first)
		temp = getOne(a + 1, n, a);
	int b = temp.second;
	printf("2 %d %d\n", a, b);
	fflush(stdout);

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cwctype>
#include <functional>
using namespace std;

char s[10];
int n;

int query(int a, int b) {
	printf("1 %d %d\n", a, b);
	fflush(stdout);
	memset(s, 0, sizeof(s));
	scanf("%s", s);
	if (s[0] == 'T')
		return 0;
	else
		return 1;
}

pair<bool, int> getOne(int a, int b, int good) {
	int len = b - a + 1;
	while (len > 3) {
		int shift = len / 3;
		int first = a + shift;
		int second = b - shift;
		int res = query(first, second);
		int mid = len - 2 * (shift + 1);
		int midL = a + shift + (mid + 1) / 2;
		int midR = b - shift - (mid + 1) / 2;
		if (res == 0) {
			b = midL;
		} else {
			a = midR;
		}
		len = b - a + 1;
	}

	if (a == b) {
		if (good == -1)
			throw 42;
		int res = query(a, good);
		if (res == 0)
			return make_pair(true, a);
		else
			return make_pair(false, a);
	}

	int cur = a;
	int ans;
	for (; cur <= b; ++cur) {
		bool goodCur = true;
		for (int i = cur + 1; i <= b; ++i) {
			int res = query(cur, i);
			if (res != 0) {
				goodCur = false;
				break;
			}
		}
		if (goodCur) {
			ans = cur;
			break;
		}
	}
	if (good == -1 || query(ans, good) == 0) {
		return make_pair(true, ans);
	} else {
		return make_pair(false, ans);
	}
}

int main () {
#ifndef ONLINE_JUDGE
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif

	scanf("%d%*d", &n);

	int a = getOne(1, n, -1).second;
	pair<bool, int> temp(false, 0);
	if (a != 1)
		temp = getOne(1, a - 1, a);
	if (!temp.first)
		temp = getOne(a + 1, n, a);
	int b = temp.second;
	printf("2 %d %d\n", a, b);
	fflush(stdout);

	return 0;
}


#include <iostream>
#include <cstring>
#include <math.h>
#include <stdio.h>
using namespace std;

int query(int x, int y) {
	if (x == -1)return 0;
	cout << 1 << ' ' << x << ' ' << y << endl;
	char x;
	for (int i = 0; i < 3; ++i) cin >> x;
	return ('K' == x);
}

int get(int l, int r) {
	if (l>r)return -1;

	while (l<r) {
		int m = (l + r) / 2;
		if (query(m, m + 1)) {
			r = m;
		}
		else l = m + 1;
	}
	return l;
}

int main() {
	int n, k;
	cin >> n >> k;

	int x = get(1, n);
	int y = get(1, x - 1);
	if (!query(y, x))y = get(x + 1, n);
	cout << 2 << ' ' << x << ' ' << y << endl;

	return 0;
}


#include <iostream>
#include <cstring>
#include <math.h>
#include <stdio.h>
using namespace std;

int query(int x, int y) {
	if (x == -1)return 0;
	cout << 1 << ' ' << x << ' ' << y << endl;
	fflush(stdout);
	char a;
	for (int i = 0; i < 3; ++i) cin >> a;
	return ('K' == a);
}

int get(int l, int r) {
	if (l>r)return -1;

	while (l<r) {
		int m = (l + r) / 2;
		if (query(m, m + 1)) {
			r = m;
		}
		else l = m + 1;
	}
	return l;
}

int main() {
	int n, k;
	cin >> n >> k;

	int x = get(1, n);
	int y = get(1, x - 1);
	if (!query(y, x))y = get(x + 1, n);
	cout << 2 << ' ' << x << ' ' << y << endl;

	return 0;
}


#pragma GCC optimize("O3")

#define _SCL_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS

#include <cassert>
#include <ciso646>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <array>
#include <bitset>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <algorithm>
#include <complex>
#include <functional>
#include <initializer_list>
#include <iterator>
#include <limits>
#include <locale>
#include <numeric>
#include <regex>
#include <string>
#include <utility>
#include <fstream>
#include <iostream>
#include <sstream>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define x first
#define y second
#define speedup cout.tie(nullptr);cin.tie(nullptr);ios_base::sync_with_stdio(false)
#define coutdouble cout<<setprecision(20);cout<<fixed

#define all(v) (v).begin(),(v).end()
/*------CommentInInteractive--------*/
//#define endl "\n"
/*----------------------------------*/
const int INF = 1000 * 1000 * 1000 + 322;
const ll LLINF = 2LL * 1000LL * 1000LL * 1000LL * 1000LL * 1000LL * 1000LL;
const ll MOD = 1000 * 1000 * 1000 + 7;
const int RMOD = MOD - 2;
const int N = 3000 * 1000 + 10;
const int P1M = 1336337; //Large prime ( ~1M )
const int P1K = 1009; //Big prime ( ~1K )
const ld EPS = 1e-9;
const ld PI = 3.1415926535897932384626433832795;
/*------------------------------------------------IO_OPERATORS---------------------------------------------*/
template<typename T, typename U> inline ostream &operator << (ostream &_out, const pair<T, U> &_p) { _out << _p.first << ' ' << _p.second; return _out; }
template<typename T, typename U> inline istream &operator >> (istream &_in, pair<T, U> &_p) { _in >> _p.first >> _p.second; return _in; }
template<typename T> inline ostream &operator << (ostream &_out, const vector<T> &_v) { if (_v.empty()) return _out; _out << _v.front(); for (auto _it = ++_v.begin(); _it != _v.end(); ++_it) _out << ' ' << *_it; return _out; }
template<typename T> inline istream &operator >> (istream &_in, vector<T> &_v) { for (auto &_i : _v) _in >> _i; return _in; }
template<typename T> inline ostream &operator << (ostream &_out, const set<T> &_s) { if (_s.empty()) return _out; _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out << ' ' << *_it; return _out; }
template<typename T> inline ostream &operator << (ostream &_out, const multiset<T> &_s) { if (_s.empty()) return _out; _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out << ' ' << *_it; return _out; }
template<typename T> inline ostream &operator << (ostream &_out, const unordered_set<T> &_s) { if (_s.empty()) return _out; _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out << ' ' << *_it; return _out; }
template<typename T> inline ostream &operator << (ostream &_out, const unordered_multiset<T> &_s) { if (_s.empty()) return _out; _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out << ' ' << *_it; return _out; }
template<typename T, typename U> inline ostream &operator << (ostream &_out, const map<T, U> &_m) { if (_m.empty()) return _out; _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) _out << ", (" << _it->first << ": " << _it->second << ')'; return _out; }
template<typename T, typename U> inline ostream &operator << (ostream &_out, const unordered_map<T, U> &_m) { if (_m.empty()) return _out; _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) _out << ", (" << _it->first << ": " << _it->second << ')'; return _out; }
/*--------------------------------------------------IO_FILES-----------------------------------------------*/
const char * infile =
#ifdef LOCAL
""
#else
""
#endif //LOCAL
;
const char * outfile =
#ifdef LOCAL
""
#else
""
#endif //LOCAL
;
/*----------------------------------------------------MATHS------------------------------------------------*/
inline int gcd(int a, int b) { while (b) { int tmp = a%b; a = b; b = tmp; } return a; }
inline ll lcm(int a, int b) { return (ll)a*(ll)b / gcd(a, b); }
inline ll pwm(ll xx, ll pow) { ll mlt = 1; while (pow) { if (pow & 1) { mlt *= xx; xx *= xx; pow >>= 1; xx %= MOD; mlt %= MOD; } else { pow >>= 1; xx *= xx; xx %= MOD; } }return mlt; }
inline ll pw(ll xx, int pow) { ll mlt = 1; while (pow) { if (pow & 1) { mlt *= xx; xx *= xx; pow >>= 1; } else { pow >>= 1; xx *= xx; } }return mlt; }
inline ll inv(ll r) { return pwm(r, RMOD); }
/*--------------------------------------------------------------------------------------------------------*/

bool ask(int i, int j) {
	static int q = 0;
	cout << 1 <<" "<< i <<" "<< j << endl;
	fflush(stdout);
	assert(++q <= 60);
	string s;
	cin >> s;
	return s[0] == 'T';
}

void pr(int i, int j) {
	assert(i != j);
	cout << 2 <<" "<< i << " " << j << endl;
	fflush(stdout);
	return;
}

int find(int l, int r) {
	if (l == r)
		return l;
	int m = (l + r) / 2;
	bool ans = ask(m, m + 1);
	if (ans == true)
		return find(l, m);
	return find(m + 1, r);
}

inline void solve(ld tt) {
	int n, k;
	cin >> n >> k;
	int fst = find(1, n);
	if (fst == 1) {
		int sc = find(2, n);
		pr(fst, sc);
		return;
	}
	else if (fst == n) {
		int sc = find(1, n - 1);
		pr(fst, sc);
		return;
	}
	else {
		int sc1 = find(1, fst - 1), sc2 = find(fst + 1, n), sc = 0;
		if (ask(sc1, sc1))
			sc = sc1;
		else
			sc = sc2;
		pr(fst, sc);
		return;
	}
}

int main() {
	ld tt = clock();

	if (*infile != '\0')
		freopen(infile, "r", stdin);
	if (*outfile != '\0')
		freopen(outfile, "w", stdout);

	//speedup;
	coutdouble;

	//while(true)
	solve(tt);

#ifdef LOCAL
	cout << "Time: " << ((ld)clock() - tt) / CLOCKS_PER_SEC << endl;
	while (true);
#endif // LOCAL
	return 0;
}


#pragma GCC optimize("O3")

#define _SCL_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS

#include <cassert>
#include <ciso646>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <array>
#include <bitset>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <algorithm>
#include <complex>
#include <functional>
#include <initializer_list>
#include <iterator>
#include <limits>
#include <locale>
#include <numeric>
#include <regex>
#include <string>
#include <utility>
#include <fstream>
#include <iostream>
#include <sstream>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define x first
#define y second
#define speedup cout.tie(nullptr);cin.tie(nullptr);ios_base::sync_with_stdio(false)
#define coutdouble cout<<setprecision(20);cout<<fixed

#define all(v) (v).begin(),(v).end()
/*------CommentInInteractive--------*/
//#define endl "\n"
/*----------------------------------*/
const int INF = 1000 * 1000 * 1000 + 322;
const ll LLINF = 2LL * 1000LL * 1000LL * 1000LL * 1000LL * 1000LL * 1000LL;
const ll MOD = 1000 * 1000 * 1000 + 7;
const int RMOD = MOD - 2;
const int N = 3000 * 1000 + 10;
const int P1M = 1336337; //Large prime ( ~1M )
const int P1K = 1009; //Big prime ( ~1K )
const ld EPS = 1e-9;
const ld PI = 3.1415926535897932384626433832795;
/*------------------------------------------------IO_OPERATORS---------------------------------------------*/
template<typename T, typename U> inline ostream &operator << (ostream &_out, const pair<T, U> &_p) { _out << _p.first << ' ' << _p.second; return _out; }
template<typename T, typename U> inline istream &operator >> (istream &_in, pair<T, U> &_p) { _in >> _p.first >> _p.second; return _in; }
template<typename T> inline ostream &operator << (ostream &_out, const vector<T> &_v) { if (_v.empty()) return _out; _out << _v.front(); for (auto _it = ++_v.begin(); _it != _v.end(); ++_it) _out << ' ' << *_it; return _out; }
template<typename T> inline istream &operator >> (istream &_in, vector<T> &_v) { for (auto &_i : _v) _in >> _i; return _in; }
template<typename T> inline ostream &operator << (ostream &_out, const set<T> &_s) { if (_s.empty()) return _out; _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out << ' ' << *_it; return _out; }
template<typename T> inline ostream &operator << (ostream &_out, const multiset<T> &_s) { if (_s.empty()) return _out; _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out << ' ' << *_it; return _out; }
template<typename T> inline ostream &operator << (ostream &_out, const unordered_set<T> &_s) { if (_s.empty()) return _out; _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out << ' ' << *_it; return _out; }
template<typename T> inline ostream &operator << (ostream &_out, const unordered_multiset<T> &_s) { if (_s.empty()) return _out; _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out << ' ' << *_it; return _out; }
template<typename T, typename U> inline ostream &operator << (ostream &_out, const map<T, U> &_m) { if (_m.empty()) return _out; _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) _out << ", (" << _it->first << ": " << _it->second << ')'; return _out; }
template<typename T, typename U> inline ostream &operator << (ostream &_out, const unordered_map<T, U> &_m) { if (_m.empty()) return _out; _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) _out << ", (" << _it->first << ": " << _it->second << ')'; return _out; }
/*--------------------------------------------------IO_FILES-----------------------------------------------*/
const char * infile =
#ifdef LOCAL
""
#else
""
#endif //LOCAL
;
const char * outfile =
#ifdef LOCAL
""
#else
""
#endif //LOCAL
;
/*----------------------------------------------------MATHS------------------------------------------------*/
inline int gcd(int a, int b) { while (b) { int tmp = a%b; a = b; b = tmp; } return a; }
inline ll lcm(int a, int b) { return (ll)a*(ll)b / gcd(a, b); }
inline ll pwm(ll xx, ll pow) { ll mlt = 1; while (pow) { if (pow & 1) { mlt *= xx; xx *= xx; pow >>= 1; xx %= MOD; mlt %= MOD; } else { pow >>= 1; xx *= xx; xx %= MOD; } }return mlt; }
inline ll pw(ll xx, int pow) { ll mlt = 1; while (pow) { if (pow & 1) { mlt *= xx; xx *= xx; pow >>= 1; } else { pow >>= 1; xx *= xx; } }return mlt; }
inline ll inv(ll r) { return pwm(r, RMOD); }
/*--------------------------------------------------------------------------------------------------------*/

bool ask(int i, int j) {
	static int q = 0;
	cout << 1 <<" "<< i <<" "<< j << endl;
	fflush(stdout);
	assert(++q <= 60);
	string s;
	cin >> s;
	return s[0] == 'T';
}

void pr(int i, int j) {
	assert(i != j);
	cout << 2 <<" "<< i << " " << j << endl;
	fflush(stdout);
	return;
}

int find(int l, int r) {
	if (l == r)
		return l;
	int m = (l + r) / 2;
	bool ans = ask(m, m + 1);
	if (ans == true)
		return find(l, m);
	return find(m + 1, r);
}

inline void solve(ld tt) {
	int n, k;
	cin >> n >> k;
	int fst = find(1, n);
	if (fst == 1) {
		int sc = find(2, n);
		pr(fst, sc);
		return;
	}
	else if (fst == n) {
		int sc = find(1, n - 1);
		pr(fst, sc);
		return;
	}
	else {
		int sc1 = find(1, fst - 1), sc2 = find(fst + 1, n), sc = 0;
		if (ask(sc1, fst))
			sc = sc1;
		else
			sc = sc2;
		pr(fst, sc);
		return;
	}
}

int main() {
	ld tt = clock();

	if (*infile != '\0')
		freopen(infile, "r", stdin);
	if (*outfile != '\0')
		freopen(outfile, "w", stdout);

	//speedup;
	coutdouble;

	//while(true)
	solve(tt);

#ifdef LOCAL
	cout << "Time: " << ((ld)clock() - tt) / CLOCKS_PER_SEC << endl;
	while (true);
#endif // LOCAL
	return 0;
}


#include <iostream>
#include <vector>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <string>

using namespace std;

int Find(int l, int r){
  while (l != r){
    int m = l + (r - l) / 2;
    int m1 = m + 1;

    cout << "1 " << m << " " << m1 << endl;
    fflush(stdout);
    string res;
    cin >> res;
    if (res == "TAK")
      r = m;
    else
      l = m + 1;
    }
  return l;
  }

int main() {
  int n = 0, k = 0;
  cin >> n >> k;

  int meal0 = Find(1, n);
  int meal1 = 0;
  if (meal0 + 1 <= n){
    meal1 = Find(meal0 + 1, n);
    cout << "1 " << meal1 << " " << meal0 << endl;
    fflush(stdout);
    string res;
    cin >> res;
    if (res == "TAK"){
      cout << "2 " << meal0 << " " << meal1 << endl;
      fflush(stdout);
      }
    else{
      int meal1 = Find(1, meal0 - 1);
      cout << "2 " << meal0 << " " << meal1 << endl;
      fflush(stdout);
      }
    }
  else{
    int meal1 = Find(1, meal0 - 1);
    cout << "2 " << meal0 << " " << meal1 << endl;
    fflush(stdout);
    }
  return 0;
  }


#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
string s;
int gtnel1(int n,int k){
    cout<<"1 1 2"<<endl;
    fflush(stdout);
    cin>>s;
    if(s=="TAK")
        return 1;
    cout<<"1 "<<n-1<<" "<<n<<endl;
    fflush(stdout);
    cin>>s;
    if(s=="NIE")
        return n;
    int l=1,r=n-1;
    while(l<r-1){
        int tm=(l+r)/2;
        cout<<1<<" "<<tm<<" "<<tm+1<<endl;
        fflush(stdout);
        cin>>s;
        if(s=="TAK")
            r=tm;
        else
            l=tm;
    }
    return r;
}
int gtdzax(int n,int k,int a1){
    if(a1==1)
        return -1;
    cout<<1<<" "<<a1-1<<" "<<a1<<endl;
    fflush(stdout);
    cin>>s;
    if(s=="TAK")
        return a1-1;
    int l=1,r=a1;
    while(l<r-1){
        int tm=(l+r)/2;
        cout<<1<<" "<<tm<<" "<<tm+1<<endl;
        fflush(stdout);
        cin>>s;
        if(s=="NIE")
            l=tm;
        else
            r=tm;
    }
    if(r==a1)
        return -1;
    return r;
}
int gtaj(int n,int k,int a1){
    cout<<1<<" "<<n-1<<" "<<n<<endl;
    fflush(stdout);
    cin>>s;
    if(s=="NIE")
        return n;
    cout<<1<<" "<<a1+1<<" "<<a1<<endl;
    fflush(stdout);
    cin>>s;
    if(s=="TAK")
        return a1+1;
    int l=a1,r=n;
    while(l<r-1){
        int tm=(l+r)/2;
        cout<<1<<" "<<tm+1<<" "<<tm<<endl;
        cin>>s;
        if(s=="TAK")
            l=tm;
        else
            r=tm;
    }
    return r;
}
int main(){
    int n,k;
    cin>>n>>k;
    if(n==k){
        cout<<"2 1 2"<<endl;
        fflush(stdout);
        return 0;
    }
    int a1=gtnel1(n,k);
    int a2=gtdzax(n,k,a1);
    if(a2!=-1){
        cout<<2<<" "<<a1<<" "<<a2<<endl;
        fflush(stdout);
        return 0;
    }
    a2=gtaj(n,k,a1);
    cout<<2<<" "<<a1<<" "<<a2<<endl;
    fflush(stdout);
    return 0;
}


#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

#define mod 1000000007

bool test() {
	string response;
	cin >> response;
	if (response == "TAK") return 1;
	return 0;

}
int solve(int l, int r) {

	while (r - l > 1) {
		int mid = (l + r) / 2 + (l+r)%2;

		int x = (l + mid) / 2 ;
		int y = (r + mid) / 2;
		cout << "1 " << x << " " << y << endl;
		fflush(stdout);
		if (test())
			r = mid;
		else l = mid ;
	}
	if (l == r) return r;

	cout << "1 " << l << " " << r<< endl;
	if (test()) return l;
	return r;
}

int main() {
	int n, k;
	cin >> n >> k;
	int ans1 = solve(1, n);

	int ans2 = -1;
	if (ans1 + 1 <= n) {
		int tmp = solve(ans1 + 1, n);

		cout << "1 " << tmp << " " << ans1 << endl;
		bool r1 = test();
		if (r1) {
			ans2 = tmp;
		}
	}
	if (ans2 == -1) {
		ans2 = solve(1, ans1 - 1);
		cout << "1 " << ans2 << " " << ans1 << endl;
		bool r1 = test();
		if (!r1)
			return 1;
	}
	cout << "2 " << ans1 << " " << ans2 << endl;
}


#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

#define mod 1000000007

bool test() {
	string response;
	cin >> response;
	if (response == "TAK") return 1;
	return 0;

}
int solve(int l, int r) {

	while (r - l > 1) {
		int mid = (l + r) / 2;

		int x = (l + mid) / 2;
		int y = (r + mid) / 2;
		cout << "1 " << x << " " << y << endl;
		fflush(stdout);
		if (test())
			r = mid;
		else l = mid;
	}
	if (l == r) return r;

	cout << "1 " << l << " " << r<< endl;
	if (test()) return l;
	return r;
}

int main() {
	int n, k;
	cin >> n >> k;
	int ans1 = solve(1, n);

	int ans2 = -1;
	if (ans1 + 1 <= n) {
		int tmp = solve(ans1 + 1, n);

		cout << "1 " << tmp << " " << ans1 << endl;
		bool r1 = test();
		cout << "1 " << ans1 << " " << tmp << endl;
		bool r2 = test();
		if (r1 == r2) {
			ans2 = tmp;
		}
	}
	if (ans2 == -1) {
		ans2 = solve(1, ans1 - 1);
	}
	cout << "2 " << ans1 << " " << ans2 << endl;
}


#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

#define mod 1000000007

bool test() {
	string response;
	cin >> response;
	if (response == "TAK") return 1;
	return 0;

}
int solve(int l, int r) {

	while (r - l > 1) {
		int mid = (l + r) / 2;

		int x = (l + mid) / 2;
		int y = (r + mid) / 2;
		cout << "1 " << x << " " << y << endl;
		fflush(stdout);
		if (test())
			r = mid;
		else l = mid;
	}
	cout << "1 " << l << " " << r<< endl;
	if (test()) return l;
	return r;
}

int main() {
	int n, k;
	cin >> n >> k;
	int ans1 = solve(1, n);

	int ans2 = -1;
	if (ans1 + 1 <= n) {
		int tmp = solve(ans1 + 1, n);

		cout << "1 " << tmp << " " << ans1 << endl;
		bool r1 = test();
		cout << "1 " << ans1 << " " << tmp << endl;
		bool r2 = test();
		if (r1 == r2) {
			ans2 = tmp;
		}
	}
	if (ans2 == -1) {
		ans2 = solve(1, ans1 - 1);
	}
	cout << "2 " << ans1 << " " << ans2 << endl;
}


#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

#define mod 1000000007

bool test() {
	string response;
	cin >> response;
	if (response == "TAK") return 1;
	return 0;

}
int solve(int l, int r) {

	while (r - l > 1) {
		int mid = (l + r) / 2;

		int x = (l + mid) / 2;
		int y = (r + mid) / 2 + (r+mid)%2;
		cout << "1 " << x << " " << y << endl;
		fflush(stdout);
		if (test())
			r = mid;
		else l = mid;
	}
	if (l == r) return r;

	cout << "1 " << l << " " << r<< endl;
	if (test()) return l;
	return r;
}

int main() {
	int n, k;
	cin >> n >> k;
	int ans1 = solve(1, n);

	int ans2 = -1;
	if (ans1 + 1 <= n) {
		int tmp = solve(ans1 + 1, n);

		cout << "1 " << tmp << " " << ans1 << endl;
		bool r1 = test();
		if (r1) {
			ans2 = tmp;
		}
	}
	if (ans2 == -1) {
		ans2 = solve(1, ans1 - 1);
		cout << "1 " << ans2 << " " << ans1 << endl;
		bool r1 = test();
		if (!r1)
			return 1;
	}
	cout << "2 " << ans1 << " " << ans2 << endl;
}


#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

#define mod 1000000007

bool test() {
	string response;
	cin >> response;
	if (response == "TAK") return 1;
	return 0;

}
int solve(int l, int r) {

	while (r - l > 1) {
		int mid = (l + r) / 2;

		int x = (l + mid) / 2;
		int y = (r + mid) / 2;
		cout << "1 " << x << " " << y << endl;
		fflush(stdout);
		if (test())
			r = mid;
		else l = mid;
	}
	if (l == r) return r;

	cout << "1 " << l << " " << r<< endl;
	if (test()) return l;
	return r;
}

int main() {
	int n, k;
	cin >> n >> k;
	int ans1 = solve(1, n);

	int ans2 = -1;
	if (ans1 + 1 <= n) {
		int tmp = solve(ans1 + 1, n);

		cout << "1 " << tmp << " " << ans1 << endl;
		bool r1 = test();
		if (r1) {
			ans2 = tmp;
		}
	}
	if (ans2 == -1) {
		ans2 = solve(1, ans1 - 1);
		cout << "1 " << ans2 << " " << ans1 << endl;
		bool r1 = test();
		if (!r1)
			return 1;
	}
	cout << "2 " << ans1 << " " << ans2 << endl;
}


#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

#define mod 1000000007

bool test() {
	string response;
	cin >> response;
	if (response == "TAK") return 1;
	return 0;

}
int solve(int l, int r) {

	while (r - l > 1) {
		int mid = (l + r) / 2;

		int x = (l + mid) / 2 + (l + mid) % 2;
		int y = (r + mid) / 2;
		cout << "1 " << x << " " << y << endl;
		fflush(stdout);
		if (test())
			r = mid;
		else l = mid;
	}
	if (l == r) return r;

	cout << "1 " << l << " " << r<< endl;
	if (test()) return l;
	return r;
}

int main() {
	int n, k;
	cin >> n >> k;
	int ans1 = solve(1, n);

	int ans2 = -1;
	if (ans1 + 1 <= n) {
		int tmp = solve(ans1 + 1, n);

		cout << "1 " << tmp << " " << ans1 << endl;
		bool r1 = test();
		if (r1) {
			ans2 = tmp;
		}
	}
	if (ans2 == -1) {
		ans2 = solve(1, ans1 - 1);
		cout << "1 " << ans2 << " " << ans1 << endl;
		bool r1 = test();
		if (!r1)
			return 1;
	}
	cout << "2 " << ans1 << " " << ans2 << endl;
}


#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

#define mod 1000000007

bool test() {
	string response;
	cin >> response;
	if (response == "TAK") return 1;
	return 0;

}
int solve(int l, int r) {

	while (r - l > 1) {
		int mid = (l + r) / 2 ;

		int x = mid;
		int y = mid + 1;
		cout << "1 " << x << " " << y << endl;
		fflush(stdout);
		if (test())
			r = mid;
		else l = mid ;
	}
	if (l == r) return r;

	cout << "1 " << l << " " << r<< endl;
	if (test()) return l;
	return r;
}

int main() {
	int n, k;
	cin >> n >> k;
	int ans1 = solve(1, n);

	int ans2 = -1;
	if (ans1 + 1 <= n) {
		int tmp = solve(ans1 + 1, n);

		cout << "1 " << tmp << " " << ans1 << endl;
		bool r1 = test();
		if (r1) {
			ans2 = tmp;
		}
	}
	if (ans2 == -1) {
		ans2 = solve(1, ans1 - 1);
		cout << "1 " << ans2 << " " << ans1 << endl;
		bool r1 = test();
		if (!r1)
			return 1;
	}
	cout << "2 " << ans1 << " " << ans2 << endl;
}


#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

#define mod 1000000007

bool test() {
	string response;
	cin >> response;
	if (response == "TAK") return 1;
	return 0;

}
int solve(int l, int r) {

	while (r - l > 1) {
		int mid = (l + r) / 2;

		int x = (l + mid) / 2 ;
		int y = (r + mid) / 2;
		cout << "1 " << x << " " << y << endl;
		fflush(stdout);
		if (test())
			r = mid+1;
		else l = mid - 1;
	}
	if (l == r) return r;

	cout << "1 " << l << " " << r<< endl;
	if (test()) return l;
	return r;
}

int main() {
	int n, k;
	cin >> n >> k;
	int ans1 = solve(1, n);

	int ans2 = -1;
	if (ans1 + 1 <= n) {
		int tmp = solve(ans1 + 1, n);

		cout << "1 " << tmp << " " << ans1 << endl;
		bool r1 = test();
		if (r1) {
			ans2 = tmp;
		}
	}
	if (ans2 == -1) {
		ans2 = solve(1, ans1 - 1);
		cout << "1 " << ans2 << " " << ans1 << endl;
		bool r1 = test();
		if (!r1)
			return 1;
	}
	cout << "2 " << ans1 << " " << ans2 << endl;
}


#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

#define mod 1000000007

bool test() {
	string response;
	cin >> response;
	if (response == "TAK") return 1;
	return 0;

}
int solve(int l, int r) {

	while (r - l > 1) {
		int mid = (l + r) / 2;

		int x = (l + mid) / 2;
		int y = (r + mid) / 2;
		cout << "1 " << x << " " << y << endl;
		fflush(stdout);
		if (test())
			r = mid;
		else l = mid;
	}
	if (l == r) return r;

	cout << "1 " << l << " " << r<< endl;
	if (test()) return l;
	return r;
}

int main() {
	int n, k;
	cin >> n >> k;
	int ans1 = solve(1, n);

	int ans2 = -1;
	if (ans1 + 1 <= n) {
		int tmp = solve(ans1 + 1, n);

		cout << "1 " << tmp << " " << ans1 << endl;
		bool r1 = test();
		if (r1) {
			ans2 = tmp;
		}
	}
	if (ans2 == -1) {
		ans2 = solve(1, ans1 - 1);
	}
	cout << "2 " << ans1 << " " << ans2 << endl;
}


import sys

def chek(x, y):
    if x == y:
        return 0
    else:
        print(1, x, y)
    return input() == 'TAK'

def binp(l, r):
    if l > r:
        return -1
    while l < r:
        m = (l + r) / 2
        if chek(m, m + 1):
            r = m
        else:
            l = m
    return l

n, k = list(map(int, input().split()))
x = binp(1, n)
y = binp(1, x - 1)
if chek(y, x) == False:
    y = binp(x + 1, n)
print(2, x, y)
sys.stdout.flush()


import sys

def chek(x, y):
    if x == y:
        return 0
    else:
        print(1, int(x), int(y))
    return input() == 'TAK'

def binp(l, r):
    if l > r:
        return -1
    while l < r:
        m = int((l + r) / 2)
        if chek(m, m + 1):
            r = m
        else:
            l = m + 1
    return int(l)

n, k = list(map(int, input().split()))
x = binp(1, n)
y = binp(1, x - 1)
if not chek(y, x):
    y = binp(x + 1, n)
print(2, int(x), int(y))
sys.stdout.flush()


import sys

def chek(x, y):
    if x == y:
        return 0
    else:
        print(1, int(x), int(y))
    return input() == 'TAK'

def binp(l, r):
    if l > r:
        return -1
    while l < r:
        m = int((l + r) / 2)
        if chek(m, m + 1):
            r = m
        else:
            l = m + 1
    return int(l)

n, k = list(map(int, input().split()))
x = binp(1, n)
y = binp(1, x - 1)
if chek(y, x) == False:
    y = binp(x + 1, n)
print(2, int(x), int(y))
sys.stdout.flush()


import sys

def chek(x, y):
    print(1, int(x), int(y))
    sys.stdout.flush()
    return input() == 'TAK'

def binp(l, r):
    if l == r:
        return l
    while l < r:
        m = (l + r) // 2
        if chek(m, m + 1):
            r = m
        else:
            l = m + 1
    return int(l)

n, k = list(map(int, input().split()))
x = binp(1, n)
y = binp(1, x - 1)
if not chek(y, x):
    y = binp(x + 1, n)
print(2, int(x), int(y))
sys.stdout.flush()


import sys

def chek(x, y):
    print(1, int(x), int(y))
    sys.stdout.flush()
    return input() == 'TAK'

def binp(l, r):
    if l == r:
        return l
    while l < r:
        m = (l + r) // 2
        if chek(m, m + 1):
            r = m
        else:
            l = m + 1
    return int(l)

n, k = list(map(int, input().split()))
x = binp(1, n)
y1, y2 = x,x
if x>1: y1=binp(1, x - 1)
if x<n: y2=binp(x + 1, n)
if not chek(y1, y2):
    y1, y2 = y2, y1
if x == y1:
    y1, y2 = y2, y1
print(2, x, y1)
sys.stdout.flush()


import sys

def chek(x, y):
    print(1, int(x), int(y))
    sys.stdout.flush()
    return input() == 'TAK'

def binp(l, r):
    if l > r:
        return -1
    while l < r:
        m = int((l + r) / 2)
        if chek(m, m + 1):
            r = m
        else:
            l = m + 1
    return int(l)

n, k = list(map(int, input().split()))
x = binp(1, n)
y = binp(1, x - 1)
if not chek(y, x):
    y = binp(x + 1, n)
print(2, int(x), int(y))
sys.stdout.flush()


import sys

def chek(x, y):
    if x == y:
        return 0
    else:
        print(1, int(x), int(y))
    return input() == 'TAK'

def binp(l, r):
    if l > r:
        return -1
    while l < r:
        m = (l + r) / 2
        if chek(m, m + 1):
            r = m
        else:
            l = m
    return int(l)

n, k = list(map(int, input().split()))
x = binp(1, n)
y = binp(1, x - 1)
if chek(y, x) == False:
    y = binp(x + 1, n)
print(2, int(x), int(y))
sys.stdout.flush()


import sys

def chek(x, y):
    print(1, int(x), int(y))
    sys.stdout.flush()
    return input() == 'TAK'

def binp(l, r):
    if l == r:
        return l
    while l < r:
        m = (l + r) // 2
        if chek(m, m + 1):
            r = m
        else:
            l = m + 1
    return int(l)

n, k = list(map(int, input().split()))
x = binp(1, n)
y1, y2 = binp(1, x - 1), binp(x + 1, n)
if not chek(y1, y2):
    y1, y2 = y2, y1
if x == y1:
    y1, y2 = y2, y1
print(2, x, y1)
sys.stdout.flush()


import sys
# print("2333", file = sys.stderr)
def ask(x, y) :
    print("1 {} {}".format(x, y))
    sys.stdout.flush()
    return input()

def solve(L, R) :
    if L > R :
        return -1
    while L < R :
        mid = (L + R) >> 1
        if ask(mid, mid + 1) == "TAK" :
            R = mid
        else :
            L = mid + 1
    return L

n, k = list(map(int, input().split()))
a = solve(1, n)
b, c = a, a
if a > 1 :
    b = solve(1, a - 1)
if a < n :
    c = solve(a + 1, n)
if ask(a, b) == "NIE" :
    b = c
print("2 {} {}".format(a, b))
sys.stdout.flush()


import sys
# print("2333", file = sys.stderr)
def ask(x, y) :
    print("1", x, y)
    sys.stdout.flush()
    return input()

def solve(L, R) :
    if L > R :
        return -1
    while L < R :
        mid = (L + R) >> 1
        if ask(mid, mid + 1) == "TAK" :
            R = mid
        else :
            L = mid + 1
    return L

n, k = list(map(int, input().split()))
a = solve(1, n)
b = solve(1, a - 1)
if b == -1 or ask(a, b) == "NIE" :
    b = solve(a + 1, n)
print("2", a, b)
sys.stdout.flush()


import sys
def ask(x, y) :
    print("1 {} {}".format(x, y))
    sys.stdout.flush()
    return input()

def solve(L, R) :
    if L > R :
        return -1
    while L < R :
        mid = (L + R) >> 1
        if ask(mid, mid + 1) == "TAK" :
            R = mid
        else :
            L = mid + 1
    return int(L)

n, k = list(map(int, input().split()))
a = solve(1, n)
b = solve(1, a - 1)
if b == -1 :
    b = solve(a + 1, n)
if ask(a, b) == "NIE" :
    b = solve(a + 1, n)
print("2 {} {}".format(a, b))
sys.stdout.flush()


import sys
# print("2333", file = sys.stderr)
def ask(x, y) :
    print("1", x, y)
    sys.stdout.flush()
    return input()

def solve(L, R) :
    while L < R :
        mid = (L + R) >> 1
        if ask(mid, mid + 1) == "TAK" :
            R = mid
        else :
            L = mid + 1
    return L

n, k = list(map(int, input().split()))
a = solve(1, n)
b, c = a, a
if a > 1 :
    b = solve(1, a - 1)
if a < n :
    c = solve(a + 1, n)
if ask(b, c) == "NIE" :
    b, c = c, b
if a == b :
    b, c = c, b
print("2", a, b)
sys.stdout.flush()


import sys
# print("2333", file = sys.stderr)
def ask(x, y) :
    print(1, x, y)
    sys.stdout.flush()
    return input()

def solve(L, R) :
    while L < R :
        mid = (L + R) >> 1
        if ask(mid, mid + 1) == "TAK" :
            R = mid
        else :
            L = mid + 1
    return L

n, k = list(map(int, input().split()))
a = solve(1, n)
b, c = a, a
if a > 1 :
    b = solve(1, a - 1)
if a < n :
    c = solve(a + 1, n)
if ask(a, b) == "NIE" :
    b = c
print(2, a, b)
sys.stdout.flush()


import sys
# print("2333", file = sys.stderr)
def ask(x, y) :
    print("1", x, y)
    sys.stdout.flush()
    return input()

def solve(L, R) :
    while L < R :
        mid = (L + R) >> 1
        if ask(mid, mid + 1) == "TAK" :
            R = mid
        else :
            L = mid + 1
    return L

n, k = list(map(int, input().split()))
a = solve(1, n)
b, c = a, a
if a > 1 :
    b = solve(1, a - 1)
if a < n :
    c = solve(a + 1, n)
if ask(a, b) == "NIE" :
    b, c = c, b
if a == b :
    b, c = c, b
print("2", a, b)
sys.stdout.flush()


import sys
# print("2333", file = sys.stderr)
def ask(x, y) :
    print("1", x, y)
    sys.stdout.flush()
    return input()

def solve(L, R) :
    if L > R :
        return -1
    while L < R :
        mid = (L + R) >> 1
        if ask(mid, mid + 1) == "TAK" :
            R = mid
        else :
            L = mid + 1
    return L

n, k = list(map(int, input().split()))
a = solve(1, n)
b = solve(1, a - 1)
if b == -1 or ask(a, b) == "NIE" :
    b = solve(a + 1, n)
print("2", 2, 3)
sys.stdout.flush()


def query(x, y):
        print(1, x, y)
        ans = input()
        return ans == "TAK"

def solve(L, R):
        while L < R:
                M = (L + R) // 2
                if query(M, M+1):
                        R = M
                else:
                        L = M + 1
        return L

N, K = map(int, input().split())

a = solve(1, N)
if a == 1:
        print(2, a, solve(2, N))
        exit(0)
if a == N:
        print(2, a, solve(1, N-1))
        exit(0)

b = solve(1, a-1)
if query(b, a) == False:
        b = solve(a+1, N)
print(2, a, b)


def query(x, y):
        print(1, x, y)
        ans = input()
        return ans == "TAK"

def solve(L, R):
        while L < R:
                M = (L + R) // 2
                if query(M, M+1):
                        R = M
                else:
                        L = M + 1
        return L

N, K = map(int, input().split())

a = solve(1, N)
if a == 1:
        print(2, a, solve(2, N))
        exit(0)
if a == N:
        print(2, a, solve(1, N-1))
        exit(0)

b = solve(1, a-1)
if query(a, b) == False:
        b = solve(a+1, N)
print(2, a, b)


import sys

def chek(x, y):

    print(1, int(x), int(y))

    sys.stdout.flush()

    return input() == 'TAK'

def binp(l, r):

    if l == r:

        return l

    while l < r:

        m = (l + r) // 2

        if chek(m, m + 1):

            r = m

        else:

            l = m + 1

    return int(l)

n, k = list(map(int, input().split()))

x = binp(1, n)

y1, y2 = x,x

if x>1: y1=binp(1, x - 1)

if x<n: y2=binp(x + 1, n)

if not chek(y1, y2):

    y1, y2 = y2, y1

if x == y1:

    y1, y2 = y2, y1

print(2, x, y1)

sys.stdout.flush()

# Made By Mostafa_Khaled


import math

line = lambda: map(int, input().split())

def ask(x, y):
    print(1, x, y)
    stdout.flush()
    return input() == "TAK"

def divide(l, r):
    d = r - l + 1
    if d == 1:
        return l
    m = (l + r) // 2
    if ask(m, m + 1):
        return divide(l, m)
    else:
        return divide(m + 1, r)

def solve():
    n, k = line()
    x = divide(1, n)
    y = x, z = x
    if x > 1:
        y = divide(1, x - 1)
    if x < n:
        z = divide(x + 1, n)
    if ask(y, z) == False:
        y, z = z, y
    if x == y:
        y, z = z, y
    print(2, x, y)
    stdout.flush()

def main():
    solve()
    exit(0)

if __name__ == "__main__":
    main()


import sys
import math

line = lambda: map(int, input().split())

def ask(x, y):
    print(1, x, y)
    sys.stdout.flush()
    return input() == "TAK"

def divide(l, r):
    d = r - l + 1
    if d == 1:
        return l
    m = (l + r) // 2
    if ask(m, m + 1):
        return divide(l, m)
    else:
        return divide(m + 1, r)

def solve():
    n, k = line()
    x = divide(1, n)
    y = x
    z = x
    if x > 1:
        y = divide(1, x - 1)
    if x < n:
        z = divide(x + 1, n)
    if ask(y, z) == False:
        y, z = z, y
    if x == y:
        y, z = z, y
    print(2, x, y)
    sys.stdout.flush()

def main():
    solve()
    exit(0)

if __name__ == "__main__":
    main()


from sys import stdout
n, k = map(int, raw_input().split())
def get(x, y):
    a = 3
    b = 77102
    return "TAK" if min(abs(x - a), abs(x - b)) <= min(abs(y - a), abs(y - b)) else "NIE"
def query(x, y):
    print 1, x, y
    stdout.flush()
    return raw_input().strip()
#   return get(x, y)
lo, hi = 1, n
while lo + 1 < hi:
    if query(lo, hi) == 'TAK':
        hi = (lo + hi) / 2
    else:
        lo = (lo + hi) / 2
if query(lo, hi) == 'TAK':
    if query(lo, lo + 1) == 'TAK':
        f = lo
    else:
        f = lo + 1
else:
    f = hi
lo, hi = 1, f - 1
while lo + 1 < hi:
    mid = (lo + hi) / 2
    if query(mid, mid + 1) == 'TAK':
        hi = mid
    else:
        lo = mid
g = -1
for i in xrange(lo, hi + 1):
    if query(i, f) == 'TAK':
        g = i
        break
if g != -1 and g != f:
    print 2, g, f
    stdout.flush()
    quit()
lo, hi = f + 1, n
while lo + 1 < hi:
    mid = (lo + hi) / 2
    if query(mid, mid + 1) == 'TAK':
        hi = mid
    else:
        lo = mid
for i in xrange(lo, hi + 1):
    if query(i, f) == 'TAK':
        g = i
        break
print 2, g, f
stdout.flush()


from sys import stdout
n, k = map(int, raw_input().split())
def get(x, y):
    a = 3
    b = 77102
    return "TAK" if min(abs(x - a), abs(x - b)) <= min(abs(y - a), abs(y - b)) else "NIE"
def query(x, y):
    print 1, x, y
    stdout.flush()
    return raw_input().strip()
#   return get(x, y)
lo, hi = 1, n
while lo < hi:
    mid = (lo + hi) / 2
    if query(mid, mid + 1) == 'TAK':
        hi = mid
    else:
        lo = mid + 1
f = lo
lo, hi = 1, f - 1
while lo < hi:
    mid = (lo + hi) / 2
    if query(mid, mid + 1) == 'TAK':
        hi = mid
    else:
        lo = mid + 1
g = -1
if query(lo, f) == 'TAK':
    g = i
if g != -1:
    print 2, g, f
    stdout.flush()
    quit()
lo, hi = f + 1, n
while lo + 1 < hi:
    mid = (lo + hi) / 2
    if query(mid, mid + 1) == 'TAK':
        hi = mid
    else:
        lo = mid + 1
print 2, g, f
stdout.flush()


from sys import stdout
n, k = map(int, raw_input().split())
def get(x, y):
    a = 2
    b = 1
    return "TAK" if min(abs(x - a), abs(x - b)) <= min(abs(y - a), abs(y - b)) else "NIE"
def query(x, y):
    print 1, x, y
    stdout.flush()
    return raw_input().strip()
#    return get(x, y)
lo, hi = 1, n
while lo < hi:
    mid = (lo + hi) / 2
    if query(mid, mid + 1) == 'TAK':
        hi = mid
    else:
        lo = mid + 1
f = lo
lo, hi = 1, f - 1
while lo < hi:
    mid = (lo + hi) / 2
    if query(mid, mid + 1) == 'TAK':
        hi = mid
    else:
        lo = mid + 1
g = -1
if query(lo, f) == 'TAK':
    g = lo
if g != -1 and g != f:
    print 2, g, f
    stdout.flush()
    quit()
lo, hi = f + 1, n
while lo < hi:
    mid = (lo + hi) / 2
    if query(mid, mid + 1) == 'TAK':
        hi = mid
    else:
        lo = mid + 1
g = lo
print 2, g, f
stdout.flush()


from sys import stdout
n, k = map(int, raw_input().split())
def get(x, y):
    a = 3
    b = 77102
    return "TAK" if min(abs(x - a), abs(x - b)) <= min(abs(y - a), abs(y - b)) else "NIE"
def query(x, y):
    print 1, x, y
    stdout.flush()
    return raw_input().strip()
#   return get(x, y)
lo, hi = 1, n
while lo + 1 < hi:
    mid = (lo + hi) / 2
    if query(mid, mid + 1) == 'TAK':
        hi = mid
    else:
        lo = mid + 1
if query(lo, hi) == 'TAK':
    if query(lo, lo + 1) == 'TAK':
        f = lo
    else:
        f = lo + 1
else:
    f = hi
lo, hi = 1, f - 1
while lo + 1 < hi:
    mid = (lo + hi) / 2
    if query(mid, mid + 1) == 'TAK':
        hi = mid
    else:
        lo = mid + 1
g = -1
for i in xrange(lo, hi + 1):
    if query(i, f) == 'TAK':
        g = i
        break
if g != -1:
    print 2, g, f
    stdout.flush()
    quit()
lo, hi = f + 1, n
while lo + 1 < hi:
    mid = (lo + hi) / 2
    if query(mid, mid + 1) == 'TAK':
        hi = mid
    else:
        lo = mid + 1
for i in xrange(lo, hi + 1):
    if query(i, f) == 'TAK':
        g = i
        break
print 2, g, f
stdout.flush()


from sys import stdout
n, k = map(int, raw_input().split())
def get(x, y):
    a = 2
    b = 3
    return "TAK" if min(abs(x - a), abs(x - b)) <= min(abs(y - a), abs(y - b)) else "NIE"
def query(x, y):
    print 1, x, y
    stdout.flush()
    return raw_input().strip()
#    return get(x, y)
lo, hi = 1, n
while lo < hi:
    mid = (lo + hi) / 2
    if query(mid, mid + 1) == 'TAK':
        hi = mid
    else:
        lo = mid + 1
f = lo
lo, hi = 1, f - 1
while lo < hi:
    mid = (lo + hi) / 2
    if query(mid, mid + 1) == 'TAK':
        hi = mid
    else:
        lo = mid + 1
g = -1
if query(lo, f) == 'TAK':
    g = lo
if g != -1:
    print 2, g, f
    stdout.flush()
    quit()
lo, hi = f + 1, n
while lo < hi:
    mid = (lo + hi) / 2
    if query(mid, mid + 1) == 'TAK':
        hi = mid
    else:
        lo = mid + 1
g = lo
print 2, g, f
stdout.flush()


from sys import stdout
n, k = map(int, raw_input().split())
def get(x, y):
    a = 3
    b = 77102
    return "TAK" if min(abs(x - a), abs(x - b)) <= min(abs(y - a), abs(y - b)) else "NIE"
def query(x, y):
    print 1, x, y
    stdout.flush()
    cnt += 1
    return raw_input().strip()
#   return get(x, y)
lo, hi = 1, n
while lo + 1 < hi:
    if query(lo, hi) == 'TAK':
        hi = (lo + hi) / 2
    else:
        lo = (lo + hi) / 2
if query(lo, hi) == 'TAK':
    if query(lo, lo + 1) == 'TAK':
        f = lo
    else:
        f = lo + 1
else:
    f = hi
lo, hi = 1, f - 1
while lo + 1 < hi:
    mid = (lo + hi) / 2
    if query(mid, mid + 1) == 'TAK':
        hi = mid
    else:
        lo = mid
g = -1
for i in xrange(lo, hi + 1):
    if query(i, f) == 'TAK':
        g = i
        break
if g != -1 and g != f:
    print 2, g, f
    stdout.flush()
    quit()
lo, hi = f + 1, n
while lo + 1 < hi:
    mid = (lo + hi) / 2
    if query(mid, mid + 1) == 'TAK':
        hi = mid
    else:
        lo = mid
for i in xrange(lo, hi + 1):
    if query(i, f) == 'TAK':
        g = i
        break
print 2, g, f
stdout.flush()


from sys import stdout
n, k = map(int, raw_input().split())
def get(x, y):
    a = 3
    b = 77102
    return "TAK" if min(abs(x - a), abs(x - b)) <= min(abs(y - a), abs(y - b)) else "NIE"
def query(x, y):
    print 1, x, y
    stdout.flush()
    return raw_input().strip()
#   return get(x, y)
lo, hi = 1, n
while lo + 1 < hi:
    if query(lo, hi) == 'TAK':
        hi = (lo + hi) / 2
    else:
        lo = (lo + hi) / 2
if query(lo, hi) == 'TAK':
    if query(lo, lo + 1) == 'TAK':
        f = lo
    else:
        f = lo + 1
else:
    f = hi
lo, hi = 1, f - 1
while lo + 1 < hi:
    mid = (lo + hi) / 2
    if query(mid, mid + 1) == 'TAK':
        hi = mid
    else:
        lo = mid + 1
g = -1
for i in xrange(lo, hi + 1):
    if query(i, f) == 'TAK':
        g = i
        break
if g != -1 and g != f:
    print 2, g, f
    stdout.flush()
    quit()
lo, hi = f + 1, n
while lo + 1 < hi:
    mid = (lo + hi) / 2
    if query(mid, mid + 1) == 'TAK':
        hi = mid
    else:
        lo = mid + 1
for i in xrange(lo, hi + 1):
    if query(i, f) == 'TAK':
        g = i
        break
print 2, g, f
stdout.flush()


import sys

def ask(x, y):
    print 1, x, y
    sys.stdout.flush()
    return ['TAK', 'NIE'].index(raw_input())

def search(x, w):
    if w == 1: return x
    m0 = x + (w - 1)/2
    m1 = m0 + 1
    if ask(m0, m1) == 0:
        return search(x, m0 - x + 1)
    else:
        return search(m1, x + w - m1)

n = int(raw_input().split()[0])
a0 = search(1, n)
if a0 == 1:
    a1 = search(2, n - 1)
elif a0 == n:
    a1 = search(1, n - 1)
else:
    xl = search(1, a0 - 1)
    xr = search(a0 + 1, n - a0)
    a1 = (xl, xr)[ask(xl, xr)]
print 2, a0, a1


from sys import stdout

def solve(l, r):
    if l > r:
        return -1
    while l < r:
        m = (l + r) >> 1
        print 1, m, m + 1
        stdout.flush()
        s = raw_input()
        if s == 'TAK':
            r = m
        else:
            l = m + 1
    return l

n, k = map(int, raw_input().split())
p1 = solve(1, n)
p2 = solve(p1 + 1, n)
if p2 == -1:
    p2 = solve(1, p1 - 1)
else:
    print 1, p2, p1
    stdout.flush()
    s = raw_input()
    if s == 'NIE':
        p2 = solve(1, p1 - 1)
print 2, p1, p2
stdout.flush()