#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#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 rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int i = a; i <= (n); ++i)
#define repD(i, a, n) for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a) memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair< int , int > pii;
typedef vector< int > vi;
void pre( ) {
}
bool fg = 0 ;
int inf = 1e9 ;
int q( int x,int y) {
if ( fg) x= inf- x,y= inf- y;
cout << "Q " << x<< ' ' << y<< endl;
int ans;
cin >> ans;
return ans;
}
int x1,Y1,x2,y2;
void pr( ) {
cout << "A " << x1<< ' ' << Y1<< ' ' << inf- x2<< ' ' << inf- y2<< endl;
int result; cin >> result;
if ( result! = 1 ) exit ( 0 ) ;
}
void solve( ) {
fg= 0 ;
int xl = 0 ,xu = 1e9 ;
int y = q( 0 ,0 ) ;
xu = min( xu,y) ;
while ( xl< xu) {
int mid = ( xl+ xu) / 2 ;
mid++ ;
if ( q( mid,0 ) == y- mid) xl= mid;
else xu = mid- 1 ;
}
x1 = xl,Y1 = y- x1;
xl= 0 ,xu= 1e9 ,fg= 1 ,y= q( 0 ,0 ) ;
xu = min( xu,y) ;
while ( xl< xu) {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