def cntunderk(k): y = 0 cnt = 0 for x in range(1, k+1): t = x * x while True: y += 1 if 2 * y * y >= t: y -= 1 break cnt += y + 1 return cnt n = int(input()) mx = 300000 ub = mx lb = -1 while ub - lb > 1: k = (ub + lb) // 2 if cntunderk(k) < n: lb = k else: ub = k y = 0 s = [] for x in range(lb, -1, -1): while True: if 2 * y * y < (lb - x) * (lb - x): y += 1 continue break assert 2 * y * y >= (lb - x) * (lb - x) if 2 * y * y < (lb + 1 - x) * (lb + 1 - x): s.append((x, y)) sqrt2 = 2 ** 0.5 s.sort(key = lambda x : x[0] + x[1] * sqrt2) n -= cntunderk(lb) assert n >= 1 assert n <= len(s) print(*s[n-1])