#include #include #include using namespace std; long long extgcd(long long a, long long b, long long &x, long long &y){ long long d = a; if(b != 0){ d = extgcd(b, a % b, y, x); y -= (a / b) * x; } else{ x = 1; y = 0; } return d; } int main(){ int T; cin >> T; while(T--){ long long N, A, B; cin >> N >> A >> B; long long x, y; long long g = extgcd(A, B, x, y); if(g != 1) cout << "NO" << endl; else{ if(x > 0){ long long t = x / B; x -= t * B; y += A * t; long long te = min(x * A, (y + A) * B); if(N >= te) cout << "YES" << endl; else cout << "NO" << endl; } else{ long long t = y / A; y -= A * t; x += t * B; long long te = min(y * B, (x + B) * A); if(N >= te) cout << "YES" << endl; else cout << "NO" << endl; } } } }