output_description: Print the integers contained in the boxes A, B, and C, in this order, with
  space in between.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      X Y Z
attempt: def resolve():
      import sys
  
      input = sys.stdin.readline
      k = int(input().rstrip())
  
      if k <= 9:
          # print(k)
          sys.exit()
  
      def judge(number_list, index, total):
          if index == len(number_list) - 2:  # 最後から2番目の桁
              num = number_list[index]
              add_num = 2 if num in (0, 9) else 3
              if (total + add_num) < k:
                  total += add_num
                  return total
              else:
                  if num == 0:
                      right_nums = [num, num + 1]
                  elif num == 9:
                      right_nums = [num - 1, num]
                  else:
                      right_nums = [num - 1, num, num + 1]
                  number_list[-1] = right_nums[k - total - 1]
                  # print("".join(number_list))
                  print(*number_list, sep="")
                  sys.exit()
          else:  # 最後から２番目の桁じゃない
              num = number_list[index]
              if num == 0:
                  right_nums = [num, num + 1]
              elif num == 9:
                  right_nums = [num - 1, num]
              else:
                  right_nums = [num - 1, num, num + 1]
  
              for right_num in right_nums:
                  number_list[index + 1] = right_num
                  total = judge(number_list, index + 1, total)
              return total
  
      total = 9
      num_list = [9]
      while True:
          num_list = [0 for _ in range(len(num_list) + 1)]
          for left in [1, 2, 3, 4, 5, 6, 7, 8, 9]:
              num_list[0] = left
              # print(num_list, 0, total)
              total = judge(num_list, 0, total)
  
  
  if __name__ == "__main__":
      resolve()
  
problem_description: Statement
  
  We have three boxes A, B, and C, each of which contains an integer.  
  Currently, the boxes A, B, and C contain the integers X, Y, and Z,
  respectively.  
  We will now do the operations below in order. Find the content of each box
  afterward.
  
    * Swap the contents of the boxes A and B
    * Swap the contents of the boxes A and C
samples: [{"input": "1 2 3", "output": "3 1 2\n    \n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1,\nand 3, respectively.  \nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and\n2, respectively.\n\n* * *"}, {"input": "100 100 100", "output": "100 100 100\n    \n\n* * *"}, {"input": "41 59 31", "output": "31 41 59"}]