int main()
{
int n,m,x,y;
scanf("%d%d",&n,&m);
while(n!=0||m!=0)
{
//x+y==n
//2*x+4*y==m
//2x*2y=2n
//2y=m-2n
if((m-n*2)%2==0)
{
y=(m-n*2)/2;
x=n-y;
if(x>=0&&y>=0)
{
printf("%d %d\n",x,y);
}
else puts("Error");
}
else
{
printf("Error\n");
}
scanf("%d%d",&n,&m);
}
return 0;
}