import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

int XXX;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto K = s[1];

    immutable int X = 9;
    auto G = new int[][](N+1);

    foreach (x; 0..X) {
        if ((1 << x) > N) break;
        foreach (i; 1..N+1) {
            if ((i & (1 << x)) && i != (1 << x)) {
                G[1<<x] ~= i;
            }
        }
    }

    int sm = 0;
    foreach (i; 1..N+1) {
        G[i] = G[i].sort().uniq.array;
        sm += G[i].length.to!int;
    }

    sm.writeln;
    foreach (i; 0..N) {
        foreach (j; G[i]) {
            writeln(i, " ", j);
        }
    }
    stdout.flush;


    int ask(int n) {
        debug {
            if (n == XXX) {
                writeln(n, " ", "OK");
                return 2;
            } else if (G[n].canFind(XXX) || G[XXX].canFind(n)) {
                return 1;
            } else {
                return 0;
            }
        }

        writeln(n);
        stdout.flush;


        auto s = readln.chomp;
        if (s == "Yes") {
            return 2;
        } else if (s == "Near") {
            return 1;
        } else {
            return 0;
        }
    }



    while (K--) {
        debug {
            XXX = readln.chomp.to!int;
        }
        int ans = 0;
        bool ok = false;
        foreach (x; 0..X) {
            int res = (1<<x) <= N ? ask(1<<x) : 0;
            if (res == 2) {
                ok = true;
                break;
            } else if (res == 1) {
                ans |= (1 << x);
            }
        }
        if (!ok) {
            ask(ans);
        }
    }
}

