import random sqrt2 = 2 ** 0.5 def cntunderk(k): y = 0 cnt = 0 for x in range(k, -1, -1): while True: y += 1 if x + sqrt2 * y >= k: y -= 1 break cnt += y + 1 return cnt n = int(input()) + 1 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 x + sqrt2 * y < lb: y += 1 continue break if x + sqrt2 * y < lb + 1: s.append((x, y)) s.sort(key = lambda x : x[0] + x[1] * sqrt2) n -= cntunderk(lb) #print(s) print(*s[n-1])