#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; void solve(); int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int tt = 1; //cin >> tt; while(tt--) solve(); } int dp[100][100]; int dfs(int x,int y) { if(!x && !y) return 0; if(x == y) return dp[x][y] = 1; if(dp[x][y] >= 0) return dp[x][y]; for(int i = 1;i <= x;i++) if(!dfs(x-i,y)) return dp[x][y] = 1; for(int i = 1;i <= y;i++) if(!dfs(x,y-i)) return dp[x][y] = 1; return dp[x][y] = 0; } void solve() { /*for(int i = 0;i < 100;i++)for(int j = 0;j < 100;j++) dp[i][j] = -1; for(int i = 0;i < 10;i++)for(int j = 0;j < 10;j++) { cout << "(" << i << "," << j << ") -> " << (dfs(i,j) ? "First":"Second") << "\n"; }*/ int X,Y; cin >> X >> Y; bool s = false; if(X > Y) swap(X,Y),s = true; bool f = true; if(X+1 == Y && X%2 == 1) cout << "Second" << endl,f = false; else cout << "First" << endl; cout.flush(); while(true) { if(f) { if(X == Y) cout << 'B' << endl; else { cout << 'A' << " "; cout.flush(); if(!X) cout << (s ? 1:2) << " " << Y << endl; else if(!Y) cout << (s ? 1:2) << " " << X << endl; else { if(X > Y) { cout << (s ? 2:1) << " "; cout.flush(); if(Y & 1) cout << X-Y-1 << endl,X = Y+1; else cout << X-Y+1 << endl,X = Y-1; } else { cout << (s ? 1:2) << " "; cout.flush(); if(X & 1) cout << Y-X-1 << endl,Y = X+1; else cout << Y-X+1 << endl,Y = X-1; } cout.flush(); } cout.flush(); } cout.flush(); char c; cin >> c; if(c == 'C') return; assert(c != 'B'); { int p,q; cin >> p >> q; if(s) p = 3-p; if(p == 1) X -= q; else Y -= q; } } else { char c; cin >> c; if(c == 'C') return; assert(c != 'B'); { int p,q; cin >> p >> q; if(s) p = 3-p; if(p == 1) X -= q; else Y -= q; } if(X == Y) cout << 'B' << endl; else { cout << 'A' << " "; cout.flush(); if(!X) cout << (s ? 1:2) << " " << Y << endl; else if(!Y) cout << (s ? 1:2) << " " << X << endl; else { if(X > Y) { cout << (s ? 2:1) << " "; cout.flush(); if(Y & 1) cout << X-Y-1 << endl,X = Y+1; else cout << X-Y+1 << endl,X = Y-1; cout.flush(); } else { cout << (s ? 1:2) << " "; cout.flush(); if(X & 1) cout << Y-X-1 << endl,Y = X+1; else cout << Y-X+1 << endl,Y = X-1; } } cout.flush(); } cout.flush(); } } }