Help me in solving BIRDFARM problem

My issue

how is total no of legs related to legs of each chicken and duck?

My code

#include <iostream>
using namespace std;

int main() {
    int t;
    cin >> t;
    for(int i; i<t ; i++){
        int x;
        int y;
        int z;
        cin >> x>> y>> z;
        if (z = x+y){
            cout << "none\n";
        }
        else if (z=y=x){
            cout << "any\n";
        }
        else if (z < x+y ){
            if (x>y){
                cout <<"chicken\n";
            }
            else {
                cout << "duck\n";
            }
        }
        
    }
	// your code goes here
	return 0;
}

Problem Link: Chef and Bird farm Practice Coding Problem - CodeChef

include
using namespace std;

int main() {
// your code goes here
int t;
cin>>t;
while(t–){
int a,b,c;
cin>>a>>b>>c;
if(c%a==0 && c%b==0){
cout<<“any”<<endl;

    }
    else if(c%b==0){
        cout<<"duck"<<endl;
        
    
    }
    else if(c%a==0){
        cout<<"chicken"<<endl;
        
    }
    else{
        cout<<"none"<<endl;
        
    }
}
    return 0;

}
//here think logically ,treat chicken and duck as objects not as real animals