#include
#include
#include
#define N 102
int main()
{
int a,b,c,d;
int arr[N],brr[N],crr[N],drr[N];
while(scanf("%d %d",&a,&b)!=EOF&&(a||b))
{
memset(arr,0,sizeof(arr));
memset(brr,0,sizeof(brr));
memset(crr,0,sizeof(crr));
memset(drr,1,sizeof(drr));
for(int i=0;i