output_description: Print T lines. The i-th line should contain `Yes` if Snuke can buy apple juice
  indefinitely in the i-th query; `No` otherwise.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      T
      A_1 B_1 C_1 D_1
      A_2 B_2 C_2 D_2
      :
      A_T B_T C_T D_T
      
  
  In the i-th query, A = A_i, B = B_i, C = C_i, D = D_i.
attempt: #include<bits/stdc++.h>
  using namespace std;
  #define ALL(x) x.begin(),x.end()
  #define rep(i,n) for(int i=0;i<n;i++)
  #define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
  #define INF 1000000000
  #define mod 1000000007
  typedef long long ll;
  const ll LINF = 1001002003004005006ll;
  int dx[]={1,0,-1,0};
  int dy[]={0,1,0,-1};
  ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
  template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
  template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
  
  signed main(){
      cin.tie(0);
      ios::sync_with_stdio(0);
      
  
      ll t;cin>>t;
      while(t--){
          ll a,b,c,d;cin>>a>>b>>c>>d;
          ll rem=a;
          while(true){
              if(rem/b==0){
                  cout<<"No"<<endl;
                  break;
              }
              rem%=b;
              if(rem<=c) rem+=d;
              if(rem==a){
                  cout<<"Yes"<<endl;
                  break;
              }
          }
      }
      return 0;
  }
  
problem_description: Statement
  
  Ringo Mart, a convenience store, sells apple juice.
  
  On the opening day of Ringo Mart, there were A cans of juice in stock in the
  morning. Snuke buys B cans of juice here every day in the daytime. Then, the
  manager checks the number of cans of juice remaining in stock every night. If
  there are C or less cans, D new cans will be added to the stock by the next
  morning.
  
  Determine if Snuke can buy juice indefinitely, that is, there is always B or
  more cans of juice in stock when he attempts to buy them. Nobody besides Snuke
  buy juice at this store.
  
  Note that each test case in this problem consists of T queries.
samples: [{"input": "14\n    9 7 5 9\n    9 7 6 9\n    14 10 7 12\n    14 10 8 12\n    14 10 9 12\n    14 10 7 11\n    14 10 8 11\n    14 10 9 11\n    9 10 5 10\n    10 10 5 10\n    11 10 5 10\n    16 10 5 10\n    1000000000000000000 17 14 999999999999999985\n    1000000000000000000 17 15 999999999999999985", "output": "No\n    Yes\n    No\n    Yes\n    Yes\n    No\n    No\n    Yes\n    No\n    Yes\n    Yes\n    No\n    No\n    Yes\n    \n\nIn the first query, the number of cans of juice in stock changes as follows:\n(D represents daytime and N represents night.)\n\n9 \u2192D 2 \u2192N 11 \u2192D 4 \u2192N 13 \u2192D 6 \u2192N 6 \u2192D x\n\nIn the second query, the number of cans of juice in stock changes as follows:\n\n9 \u2192D 2 \u2192N 11 \u2192D 4 \u2192N 13 \u2192D 6 \u2192N 15 \u2192D 8 \u2192N 8 \u2192D 1 \u2192N 10 \u2192D 3 \u2192N 12 \u2192D 5 \u2192N 14\n\u2192D 7 \u2192N 7 \u2192D 0 \u2192N 9 \u2192D 2 \u2192N 11 \u2192D \u2026\n\nand so on, thus Snuke can buy juice indefinitely.\n\n* * *"}, {"input": "24\n    1 2 3 4\n    1 2 4 3\n    1 3 2 4\n    1 3 4 2\n    1 4 2 3\n    1 4 3 2\n    2 1 3 4\n    2 1 4 3\n    2 3 1 4\n    2 3 4 1\n    2 4 1 3\n    2 4 3 1\n    3 1 2 4\n    3 1 4 2\n    3 2 1 4\n    3 2 4 1\n    3 4 1 2\n    3 4 2 1\n    4 1 2 3\n    4 1 3 2\n    4 2 1 3\n    4 2 3 1\n    4 3 1 2\n    4 3 2 1", "output": "No\n    No\n    No\n    No\n    No\n    No\n    Yes\n    Yes\n    No\n    No\n    No\n    No\n    Yes\n    Yes\n    Yes\n    No\n    No\n    No\n    Yes\n    Yes\n    Yes\n    No\n    No\n    No"}]