#include using namespace std; #define ALL(x) (x).begin(), (x).end() #define REP(i,n) for(int i=0; ib ? a=b, true : false; } using ll=long long; const int INF=1e9+10; const ll INFL=4e18; #ifdef DEBUG #include "./debug.hpp" #else #define debug(...) #define print_line #endif //---------------------------------------------------------- ll N,A,B; ll mex(set st) { ll ret=0; while(st.count(ret)) ret++; return ret; } map memo; ll grundy(ll x) { if(x>=N) return 0; if(memo.count(x)) return memo[x]; set st; st.insert(grundy(x+A)); st.insert(grundy(x+B)); return memo[x]=mex(st); } void solve() { cin>>N>>A>>B; for(int i=0; i<=min(3000ll,N); i++) debug(i,grundy(i)); //[N-A~N-1]:=1 //[N-B~N-A]:=2 //[N-A-B~N-B]:=0 N-=2; N%=(A+B); if(N>=B) cout<<"sepa"<>T; while(T--) solve(); }