x0 = 0 x1 = 10**5 y0 = 0 y1 = 10**5 cnt = 0 A = [] B = [] while True: if len(B)>0: a,b = B.pop() elif cnt%4==0: a = (3*x0+x1)//4 b = (3*y0+y1)//4 elif cnt%4==1: a = (x0+3*x1)//4 b = (3*y0+y1)//4 elif cnt%4==2: a = (x0+3*x1)//4 b = (y0+3*y1)//4 else: a = (3*x0+x1)//4 b = (y0+3*y1)//4 print(a,b) d = int(input()) # d = abs(100000-a)+abs(50000-b) # print(f"(x0,x1)=({x0},{x1}), (y0,y1)=({y0},{y1}), cnt={cnt}, d={d},len(B)={len(B)}") if d==0:break if d<=2 and len(B)==0: for di in range(-2,3): for dj in range(-2,3): if abs(di)+abs(dj)<=2: B.append((a+di,b+dj)) if len(B)>0: cnt += 1 continue A.append((a,b,cnt%4,d)) if cnt%4==3: dmin = 10**9 for i in range(4): a,b,cnt0,d = A[i] if d