output_description: If it is impossible to partition the integers satisfying the condition, print
  `-1`. If it is possible, print N triples in the following format:
  
      
      
      a_1 b_1 c_1
      :
      a_N b_N c_N
      
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N K
attempt: from random import random
  
  
  class TreapNode:
      def __init__(self, val):
          self.val = val
          self.priority = random()
          self.parent = None
          self.right = None
          self.left = None
  
  
  class Treap:
      def __init__(self, is_multiset=False):
          self.root = None
          self.is_multiset = is_multiset
  
      def search(self, val: int) -> bool:
          ptr = self.root
          while ptr is not None:
              if ptr.val == val:
                  return True
              if val < ptr.val:
                  ptr = ptr.left
              else:
                  ptr = ptr.right
          return False
  
      def insert(self, val: int):
          if self.root is None:
              self.root = TreapNode(val)
              return
  
          ptr = self.root
          while True:
              if val < ptr.val:
                  if ptr.left is None:
                      ptr.left = TreapNode(val)
                      ptr.left.parent = ptr
                      ptr = ptr.left
                      break
                  ptr = ptr.left
              else:
                  if val == ptr.val and not self.is_multiset:
                      return
                  if ptr.right is None:
                      ptr.right = TreapNode(val)
                      ptr.right.parent = ptr
                      ptr = ptr.right
                      break
                  ptr = ptr.right
  
          while (ptr.parent is not None) and (ptr.parent.priority > ptr.priority):
              if ptr.parent.right == ptr:
                  self.rotate_left(ptr.parent)
              else:
                  self.rotate_right(ptr.parent)
          if ptr.parent is None:
              self.root = ptr
  
      def delete(self, val: int):
          if self.root is None:
              return
  
          ptr = self.root
          while True:
              if ptr is None:
                  return
              if ptr.val == val:
                  break
              elif val < ptr.val:
                  ptr = ptr.left
              else:
                  ptr = ptr.right
  
          while (ptr.left is not None) or (ptr.right is not None):
              if ptr.left is None:
                  self.rotate_left(ptr)
              elif ptr.right is None:
                  self.rotate_right(ptr)
              elif ptr.left.priority < ptr.right.priority:
                  self.rotate_right(ptr)
              else:
                  self.rotate_left(ptr)
              if self.root == ptr:
                  self.root = ptr.parent
  
          if ptr.left is None and ptr.right is None:
              if ptr == self.root:
                  self.root = None
              elif ptr.parent.left == ptr:
                  ptr.parent.left = None
              else:
                  ptr.parent.right = None
  
      def search_min(self, ptr):
          while True:
              if ptr.left is None:
                  return ptr
              ptr = ptr.left
          return ptr
  
      def search_max(self):
          ptr = self.root
          while True:
              if ptr.right is None:
                  return ptr.val
              ptr = ptr.right
  
      def rotate_left(self, ptr):
          w = ptr.right
          w.parent = ptr.parent
          if w.parent is not None:
              if w.parent.left == ptr:
                  w.parent.left = w
              else:
                  w.parent.right = w
          ptr.right = w.left
          if ptr.right is not None:
              ptr.right.parent = ptr
          ptr.parent = w
          w.left = ptr
          if ptr == self.root:
              self.root = w
              self.root.parent = None
  
      def rotate_right(self, ptr):
          w = ptr.left
          w.parent = ptr.parent
          if w.parent is not None:
              if w.parent.right == ptr:
                  w.parent.right = w
              else:
                  w.parent.left = w
          ptr.left = w.right
          if ptr.left is not None:
              ptr.left.parent = ptr
          ptr.parent = w
          w.right = ptr
          if ptr == self.root:
              self.root = w
              self.root.parent = None
  
      def search_less_than(self, val):
          if val == None:
              return None
          ptr = self.root
          ret = None
          while ptr is not None:
              if ptr.val == val:
                  return ptr.val
              elif ptr.val < val:
                  ret = ptr.val
                  ptr = ptr.right
              else:
                  ptr = ptr.left
          return ret
  
  
  n, k = map(int, input().split())
  tp = Treap()
  
  for i in range(2 * n):
      tp.insert(k + i)
  
  ans = []
  for i in range(n)[::-1]:
      right = k + 2 * n + i
      left1 = tp.search_max()
      tp.delete(left1)
      left2 = tp.search_less_than(right - left1)
      if left2 is None:
          print(-1)
          exit()
      tp.delete(left2)
      ans.append((left1, left2, right))
  for i in ans:
      print(*i)
  
problem_description: Statement
  
  Given are positive integers N and K.
  
  Determine if the 3N integers K, K+1, ..., K+3N-1 can be partitioned into N
  triples (a_1,b_1,c_1), ..., (a_N,b_N,c_N) so that the condition below is
  satisfied. Any of the integers K, K+1, ..., K+3N-1 must appear in exactly one
  of those triples.
  
    * For every integer i from 1 to N, a_i + b_i \leq c_i holds.
  
  If the answer is yes, construct one such partition.
samples: [{"input": "1 1", "output": "1 2 3\n    \n\n* * *"}, {"input": "3 3", "output": "-1"}]