output_description: For each process, prints its name and the time the process finished in order.
input_description: _n_ _q_  
  _name 1 time1_  
  _name 2 time2_  
  ...  
  _name n timen_  
  
  In the first line the number of processes _n_ and the quantum _q_ are given
  separated by a single space.
  
  In the following _n_ lines, names and times for the _n_ processes are given.
  _name i_ and _time i_ are separated by a single space.
attempt: class Process:
      def __init__(self, process_name, process_time):
          self.name = process_name
          self.time = process_time
          self.remaing_time = process_time
          self.complete_flg = False
  
      def get_name(self):
          return self.name
  
      def get_time(self):
          return self.time
  
      def get_remaining_time(self):
          return self.remaing_time
  
      def exec_process(self, quantum):
          if self.remaing_time <= quantum:
              self.complete_flg = True
              use_time = self.remaing_time
              self.remaing_time = 0
              return use_time
          else:
              self.remaing_time -= quantum
              return quantum
  
      def get_complete_flg(self):
          return self.complete_flg
  
  
  if __name__ == "__main__":
      n, q = [int(x) for x in input().split()]
      all_time = 0
      procesies = []
      for _ in range(n):
          name, time = input().split()
          temp_process = Process(name, int(time))
          procesies.append(temp_process)
  
      while len(procesies) != 0:
          target_process = procesies.pop(0)
          all_time += target_process.exec_process(q)
          if target_process.get_complete_flg():
              print(target_process.get_name() + " " + str(all_time))
          else:
              procesies.append(target_process)
  
problem_description: Input
  
  _n_ _q_  
  _name 1 time1_  
  _name 2 time2_  
  ...  
  _name n timen_  
  
  In the first line the number of processes _n_ and the quantum _q_ are given
  separated by a single space.
  
  In the following _n_ lines, names and times for the _n_ processes are given.
  _name i_ and _time i_ are separated by a single space.
samples: [{"input": "5 100\n    p1 150\n    p2 80\n    p3 200\n    p4 350\n    p5 20", "output": "p2 180\n    p5 400\n    p1 450\n    p3 550\n    p4 800"}]