시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 (추가 시간 없음) 1024 MB76543870.370%

문제

The United Credit Finance (UCF) is running a simple scenario to see how many customers are happy with the company. UCF has one person (teller) serving the customers. Customers are numbered 1-n, and they arrive for service in sequential order, i.e., Customer 1 arrives first, then Customer 2, then Customer 3, etc. Also, no two customers arrive at the same time, i.e., Customer 2 will arrive later than Customer 1, Customer 3 will arrive later than Customer 2, etc. Customers are also processed in the order of arrival (i.e., not out of order).

As you might have noticed while waiting in a line, some customers get impatient and leave. Given the information about the UCF customers, you are to determine which customers are happy, i.e., they don’t leave before being processed.

입력

The first input line contains an integer, n (1 ≤ n ≤ 103), indicating how many different customers are arriving. Each of the next n input lines contains the information about a customer as follows:

  • customer number (1, 2, 3, etc., in sequential order),
  • arrival time (an integer between 1 and 104, inclusive),
  • service time (an integer between 1 and 104, inclusive) indicating how long it will take the teller to process this customer (once the customer is at the teller),
  • patience time (an integer between 1 and 104, inclusive) indicating how long the customer will wait in line before giving up and leaving, i.e., if the customer is not at the teller, the customer will leave. Note that if a customer leaves, the teller will not process them, i.e., the customer will not take the teller’s time.

출력

Print the happy customer numbers in sequential order (happy means they were processed, i.e., did not leave).

예제 입력 1

7
1 50 10 5
2 52 5 4
3 58 20 5
4 85 7 10
5 86 10 1
6 88 20 3
7 89 30 3

예제 출력 1

1
3
4
7
  • The teller is done with Customer 1 at time 60 (50 + 10). This means the teller can process the next customer at time 60.
  • Customer 2 arrives at time 52. The patience time for this customer is 4 so, since they arrive at time 52, if processing them does not start by time 56 (52 + 4), they leave. The teller is done with Customer 1 at time 60 so Customer 2 leaves. Note that if a customer leaves, they will not take the teller’s time.
  • Since Customer 2 leaves, the teller can start Customer 3 at time 60 (this customer was willing to wait until time 63 to start being processed). The teller is done with Customer 3 at time 80 (60 + 20).
  • The teller is done with Customer 4 at time 92 (85 + 7). Note that the teller doesn’t have customers from time 80 (when the teller is done with Customer 3) to time 85 (when Customer 4 arrives).
  • Customer 5 arrives at time 86 and expects to be processed starting at time 87, so they leave (the teller is done with Customer 4 at time 92).
  • Customer 6 arrives at time 88 and expects to be processed starting at time 91, so they leave (the teller is done with Customer 4 at time 92).
  • Customer 7 arrives at time 89 and expects to be processed starting at time 92. The teller is available at that time (teller is done with Customer 4 at time 92) so this customer is processed.