#include<stdio.h>
int main()
{
long int n,a,b,result,r,k,i;
while(scanf("%ld",&n)!=EOF)
{
for(i=0;i<n;i++)
{
scanf("%ld%ld",&a,&b);
if((a<b)||((a%2==1)&&(b%2==0))||((b%2==1)&&(a%2==0)))
printf("impossible\n");
else
{
k=(a-b)/2;
result=b+k;
printf("%ld %ld\n",result,k);
}
}
}
return 0;
}
int main()
{
long int n,a,b,result,r,k,i;
while(scanf("%ld",&n)!=EOF)
{
for(i=0;i<n;i++)
{
scanf("%ld%ld",&a,&b);
if((a<b)||((a%2==1)&&(b%2==0))||((b%2==1)&&(a%2==0)))
printf("impossible\n");
else
{
k=(a-b)/2;
result=b+k;
printf("%ld %ld\n",result,k);
}
}
}
return 0;
}
No comments:
Post a Comment