Money Mismanagement

View as PDF

Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

Indra is not very good at managing their money. They try to purchase items without checking their bank account, and don't know which purchase went through, or which ones failed. Could you write a program to help them?

Indra begins with n dollars, and there are m events that occur in order: either Indra receives their paycheck of x dollars, or tries to purchase an item worth x dollars. If Indra has less than x dollars in their account, the purchase fails, and Indra loses no money.

Input

The first line contains integers n and m, the starting money and the number of events respectively. The following m lines contain each event, of the following form:

  • 1 x, which represents Indra receiving x dollars
  • 2 x, which represents Indra attempting to purchase an item worth x.

Output

For each purchase attempt, output a line containing SUCCEED or FAIL.

Constraints

  • 1 \le n,m,x \le 1000

Example 1

Input
3 10
1 5
1 4
2 6
1 1
2 3
2 4
2 9
2 9
1 4
1 4
Output
SUCCEED
SUCCEED
SUCCEED
FAIL
FAIL

Example 2

Input
1 10
2 3
1 5
1 2
1 5
1 5
2 5
2 9
1 2
1 2
1 2
Output
FAIL
SUCCEED
SUCCEED

Comments

There are no comments at the moment.