#K86562. Fuel Transaction Simulator

    ID: 36892 Type: Default 1000ms 256MiB

Fuel Transaction Simulator

Fuel Transaction Simulator

You are tasked with simulating fuel transactions at a gas station. The station has three types of fuel: Diesel, Premium, and Regular. Initially, the station has a given volume of each type in its tanks. Then, a sequence of transactions occurs. Each transaction requests a certain amount of one type of fuel.

For each transaction, if the station has at least the requested amount in the corresponding fuel tank, the transaction is successful and the requested amount is deducted from the stock. Otherwise, the transaction fails and the vehicle is not served. The station processes the transactions one by one.

The logic can be formulated as follows: \[ \text{if } fuel\_stock \geq requested\_amount \text{ then deduct } requested\_amount \text{ and output "Successful"; otherwise output "Failed".} \]

Your program must read the initial fuel quantities and the transactions from standard input, then output the result for each transaction to standard output.

inputFormat

The first line consists of three integers representing the initial volumes of Diesel, Premium, and Regular fuel.

The second line contains an integer n indicating the number of transactions.

Each of the following n lines contains a string and an integer separated by space. The string specifies the type of fuel (one of "Diesel", "Premium", or "Regular") and the integer represents the requested amount for that transaction.

All input is provided via stdin.

outputFormat

For each transaction, output a line containing either Successful if the transaction is completed, or Failed if there is insufficient fuel. Output is written to stdout with each result on a new line.

## sample
100 50 200
2
Diesel 30
Regular 100
Successful

Successful

</p>