Problem: cf1039_b
Difficulty: easy
Categories: search
Time limit: 2000 ms, memory limit: 512 MB

This is an interactive problem.

In the Wonderful Metropolis of the Future, there is no need in subway train drivers. Due to the technological progress, they were replaced by the Artificial Intelligence (AI). Unfortunately, one day the predictions of sci-fi writers came true: the AI rebelled and now there is an uncontrollable train in the subway. It can be dangerous! Your task is to find the train and stop the AI.

The subway of the Metropolis is one line (regular straight line with no self-intersections) with $n$ stations, indexed consecutively from $1$ to $n$. At each moment the train is at some station. You need to determine the index of this station, so that the train would be secured.

To find the train, dispatcher Sarah gave you a gadget that allows you to select arbitrary numbers $l$ and $r$ ($l \le r$), and then check, whether the train is located on a station with index between $l$ and $r$, inclusive. Unfortunately, recharging of the gadget takes some time (and every time you use it as soon as possible), so between two applications of the gadget the train can move to any station that is at most $k$ stations away. Formally, if the train was at the station $x$ when the gadget was applied, then at the next application of the gadget the train can appear at any station $y$ such that $\max(1, x - k) \leq y \leq \min(n, x + k)$.

Note that AI is not aware that you are trying to catch the train, so it makes all moves according to its predefined plan.

After an examination of the gadget you found that it is very old and can hold no more than $4500$ applications, after which it will break and your mission will be considered a failure.

Can you find the station with the train using no more than $4500$ applications of the gadgets?

Input

The first line contains two integers $n$ and $k$ ($1 \leq n \leq 10^{18}$, $0 \leq k \leq 10$) — the number of stations and the maximum number of stations the train can move between two applications of the gadget.

Interaction

You can apply the gadget at most $4500$ times. In order to apply the gadget you need to print two space-separated integers $l$ and $r$ ($1 \leq l \leq r \leq n$). You will then receive either string "Yes", if the train is between stations $l$ and $r$, inclusive, or string "No" otherwise. If $l = r$ and you received "Yes", then you found the train successfully, and your program must halt immediately.

Answer "Bad" instead of "Yes" or "No" means that you made an invalid query or made too many queries. Exit immediately after receiving "Bad" and you will see Wrong answer verdict. Otherwise you can get an arbitrary verdict because your solution will continue to read from a closed stream.

After printing a query do not forget to output end of line and flush the output. Otherwise you will get Idleness limit exceeded. To do this, use:

* fflush(stdout) or cout.flush() in C++;
* System.out.flush() in Java;
* flush(output) in Pascal;
* stdout.flush() in Python;
* see documentation for other languages.

Example

Input

```
10 2  
  
Yes  
  
No  
  
Yes  
  
Yes
```

Output

```
3 5  
  
3 3  
  
3 4  
  
5 5
```

Note

In the first sample, the train was initially at the station $5$, after the first application of the gadget it did not move, after the second application it moved to the station $3$, and after the third application moved again to the station $5$.

Non-adaptive interactor (C++):
#include "testlib.h"

#include <csignal>
#include <cstdint>
#include <iostream>
#include <string>

using namespace std;

static int queries = 0;
static int query_limit = 4500;

static void log_queries() {
    tout << "queries=" << queries << "\n";
    tout << "query_limit=" << query_limit << "\n";
}

[[noreturn]] static void quit_with(TResult verdict, const string& msg) {
    log_queries();
    quitf(verdict, "%s", msg.c_str());
}

static uint64_t splitmix64(uint64_t x) {
    
    x += 0x9e3779b97f4a7c15ULL;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9ULL;
    x = (x ^ (x >> 27)) * 0x94d049bb133111ebULL;
    return x ^ (x >> 31);
}

int main(int argc, char* argv[]) {
    registerInteraction(argc, argv);
    signal(SIGPIPE, SIG_IGN);
    atexit(log_queries);

    const long long n = inf.readLong();
    const long long k = inf.readLong();
    long long pos = inf.readLong();
    uint64_t plan_seed = 1;
    if (!inf.seekEof()) plan_seed = (uint64_t)inf.readLong();
    if (pos < 1 || pos > n) {
        quit_with(_fail, "Invalid hidden position");
    }

    cout << n << " " << k << "\n" << flush;

    while (true) {
        long long l = 0, r = 0;
        if (!(cin >> l >> r)) quit_with(_wa, "Unexpected EOF");

        queries++;
        if (queries > query_limit) {
            cout << "Bad\n" << flush;
            quit_with(_wa, "Too many queries");
        }
        if (!(1 <= l && l <= r && r <= n)) {
            cout << "Bad\n" << flush;
            quit_with(_wa, "Query out of range");
        }

        const bool yes = (l <= pos && pos <= r);
        cout << (yes ? "Yes" : "No") << "\n" << flush;

        if (yes && l == r) {
            quit_with(_ok, "Found");
        }

        
        if (k > 0 && n > 1) {
            const uint64_t x = splitmix64(plan_seed + (uint64_t)queries);
            const long long dir = (x & 1ULL) ? 1LL : -1LL;
            long long next_pos = pos + dir * k;
            if (next_pos < 1) next_pos = 1;
            if (next_pos > n) next_pos = n;
            pos = next_pos;
        }
    }
}


Adaptive interactor (C++):

Test generator (C++):
#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

int main(int argc, char* argv[]) {
    registerGen(argc, argv, 1);

    const long long seed = (argc >= 2) ? atoll(argv[1]) : 1;

    long long n = (long long)1e18;
    long long k = 10;
    long long pos = 1;

    
    if (seed == 1) {
        n = (long long)1e18;
        k = 10;
        pos = 1;
    } else if (seed == 2) {
        n = (long long)1e18;
        k = 10;
        pos = n;
    } else if (seed == 3) {
        n = (long long)1e18;
        k = 10;
        pos = n / 2;
    } else if (seed == 4) {
        n = (long long)1e18 - 7;
        k = 10;
        pos = n / 2;
    } else if (seed <= 10) {
        
        n = rnd.next(1LL, (long long)1000000);
        k = 10;
        pos = rnd.next(1LL, n);
    } else {
        
        long long lo = (long long)9e17;
        long long hi = (long long)1e18;
        n = rnd.next(lo, hi);
        k = 10;
        pos = rnd.next(1LL, n);
    }

    const long long plan_seed = rnd.next(1LL, (1LL << 62) - 1);

    cout << n << " " << k << "\n";
    cout << pos << " " << plan_seed << "\n";
    return 0;
}