text: # Write your MySQL query statement below
  SELECT
      A.PERSON_NAME
  FROM
      QUEUE A
  INNER JOIN
      QUEUE B
  ON
      A.TURN >= B.TURN
  GROUP BY A.PERSON_NAME, A.PERSON_ID
  HAVING SUM(B.WEIGHT)<=1000
  ORDER BY A.TURN DESC
  LIMIT 1
      
      
  