Help me in solving YETALICEBOB problem

My issue

help me find error in my code

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n,a,b;
	    cin>>n>>a>>b;
	    while(n--)
	    {
	        if(n%2!=0)
	        {
	         a--;
	        }
	        else
	        {
	         b--;
	        }
	        if(a==0 || a<b)
	        {
	         cout<<"Alice\n";
	         break;
	        } 
	        else if(b==0 || a>b)
	        {
	         cout<<"Bob\n";
	         break;
	        }
	    }
	        
	}

}

Problem Link: Yet Another Alice Bob Game Practice Coding Problem - CodeChef

@lalitaditya505
loop logic will not work
u have to think of some mathematical logic
plzz refer my c++ code for better understanding

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n,a,b;
	    cin>>n>>a>>b;
	    if(a>=n)
	    cout<<"Alice";
	    else
	    {
	        if(a>b)
	        cout<<"Alice";
	        else if(b>a)
	        cout<<"Bob";
	        else
	        {
	            if(n%(a+1)==0)
	            cout<<"Bob";
	            else
	            cout<<"Alice";
	        }
	    }
	    cout<<endl;
	}

}