
# taxi-q19
# Exs for Sections 17 and 18, Q.19
# Ramanujan Taxi numbers
# info: https://en.wikipedia.org/wiki/Taxicab_number
# inputs: 1 or 2 or 3 (I gave up waiting)
'''
 the smallest integer that can be expressed as a sum of two positive integer cubes in n distinct ways
'''

import math, sys

n = int(input("n=? "))
taxiNum = 1
while True:
  cubesCount = 0
  pairs = []
  # Try (i, j) to see if cube sums are taxiNum n times
  max = math.ceil(pow(taxiNum, 1/3))+1
  for i in range(1, max):
    for j in range(i, max):
      if (i*i*i + j*j*j == taxiNum):
        cubesCount += 1
        pairs.append((i,j))
        if cubesCount == n:
          print(*pairs, taxiNum)
          sys.exit()
  taxiNum += 1



