#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t;
    cin>>t;
    for(int i=1;i<=t;i++){
        int n,x,y;
        cin>>n>>x>>y;
        long long a = n*(n+1)/2;
        int c = x+y;
        int m=0;
        if(a%c==0)
        {
            cout<<"case #"<<i<<": possible"<<endl;
            if(x==y){
                cout<<n/2<<endl;
                cout<<n-n/2<<endl;
            }
            else {
                m = max(x,y);
                // cout<<m<<"m"<<endl;
                cout<<n/m<<endl;
                cout<<n-n/m<<endl;
            }
        }
        else cout<<"case #"<<i<<": impossible"<<endl;
    }
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: