直接分 3636 种情况大力分类讨论即可。当然了,直接这么写的话,代码会很长;因此,我们可以以 x=4.5x=4.5y=4.5y=4.5 为分界线,将 3636 种情况等分成 44 份,这样就只需要对 99 种情况分类讨论了。

#include <bits/stdc++.h>
using namespace std;
int dx, dy, res;
bool first()
{
    cout << "3 3" << endl;
    cin >> res;
    if (res == 2) return true;
    if (res == 1)
    {
        dx = 3;
        dy = 3;
        return false;
    }
    cout << "3 6" << endl;
    cin >> res;
    if (res == 2) return true;
    if (res == 1)
    {
        dx = 3;
        dy = 6;
        return false;
    }
    cout << "6 3" << endl;
    cin >> res;
    if (res == 2) return true;
    if (res == 1)
    {
        dx = 6;
        dy = 3;
        return false;
    }
    dx = 6;
    dy = 6;
    return false;
}
bool go()
{
    if (first()) return true;
    cout << dx + 1 << ' ' << dy + 1 << endl;
    cin >> res;
    if (res == 2) return true;
    if (res == 1)
    {
        cout << dx + 1 << ' ' << dy - 1 << endl;
        cin >> res;
        if (res == 0)
        {
            cout << dx << ' ' << dy + 1 << endl;
            cin >> res;
            return true;
        }
        cout << dx << ' ' << dy << endl;
        cin >> res;
        if (res == 2) return true;
        cout << dx + 1 << ' ' << dy << endl;
        cin >> res;
        return true;
    }
    else
    {
        cout << dx << ' ' << dy - 2 << endl;
        cin >> res;
        if (res == 0)
        {
            cout << dx - 1 << ' ' << dy << endl;
            cin >> res;
            if (res == 2) return true;
            cout << dx - 1 << ' ' << dy + 1 << endl;
            cin >> res;
            return true;
        }
        cout << dx + 1 << ' ' << dy - 1 << endl;
        cin >> res;
        if (res == 2) return true;
        if (res == 0)
        {
            cout << dx - 1 << ' ' << dy - 1 << endl;
            cin >> res;
            return true;
        }
        cout << dx << ' ' << dy - 1 << endl;
        cin >> res;
        return true;
    }
}
int main()
{
    int T;
    cin >> T;
    while (T--) go();
    return 0;
}