output_description: If it costs x yen to travel from Station A to Station C, print x.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      X Y
attempt: if __name__ == "__main__":
      ken_num, city_num = list(map(int, input().split()))
      data = []
      for i in range(city_num):
          element = list(map(int, input().split())).append(i)
          data.append(element)
      # data = [list(map(int, input().split())).append(i) for i in range(city_num)]
  
      # ken_num, city_num = 2, 3
      # data = [[1,32,0], [2,63,1],[1,12,2]]
  
      data = sorted(data, key=lambda x: (x[0], x[1]))
  
      count = 1
      ken_num = 1
      ans_data = {}
  
      for i in range(city_num):
          number = data[i][2]
          if data[i][0] != ken_num:
              count = 1
              ken_num = data[i][0]
          chr = "{0:06d}".format(ken_num) + "{0:06d}".format(count)
          ans_data.update({number: chr})
          count += 1
  
      for i in range(city_num):
          print(ans_data[i])
  
problem_description: Statement
  
  There is a train going from Station A to Station B that costs X yen (the
  currency of Japan).
  
  Also, there is a bus going from Station B to Station C that costs Y yen.
  
  Joisino got a special ticket. With this ticket, she can take the bus for half
  the fare if she travels from Station A to Station B by train and then travels
  from Station B to Station C by bus.
  
  How much does it cost to travel from Station A to Station C if she uses this
  ticket?
samples: [{"input": "81 58", "output": "110\n    \n\n  * The train fare is 81 yen.\n  * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]