#include <iostream>
using namespace std;
int main()
{
int sum1;//鸡兔头总数量;
int sum2;//鸡兔脚总数量;
int chick_count;
int rabbit_count;
cout<<"请输入头的数量:";
cin>>sum1;
cout<<"请输入脚的数量:";
cin>> sum2;
rabbit_count=(sum2-2*sum1)/2;
chick_count=sum1-rabbit_count;
cout<<chick_count<<endl<<rabbit_count ;
}