A neighborhood kiosk logs every order placed during its morning rush in the exact order customers arrived. Each logged entry records a ticket number, the customer's name, and how many items they bought. The shift supervisor only has a moment to glance at the log before opening, so they only ever look at the first three entries.
Given the full log for one morning, report just those first three orders — or the entire log if fewer than three orders were placed — printed in the same order they were logged.
Line 1: an integer n, the number of orders logged.
Next n lines: each line has three space-separated fields ticket_id customer_name item_count, in the order the orders were placed.
Print the first min(n, 3) orders, one per line, each formatted exactly as ticket_id customer_name item_count, in their original order. If n = 0, print nothing.
Example 1
Input
5 101 alice 3 102 bob 1 103 cara 5 104 dan 2 105 eve 4
Expected
101 alice 3 102 bob 1 103 cara 5
Explanation
Five orders were logged, but the supervisor only glances at the first three: ticket 101 (alice, 3 items), ticket 102 (bob, 1 item), and ticket 103 (cara, 5 items), printed in that same arrival order. Orders 104 and 105 are not shown.
Example 2
Input
2 7 sam 0 8 tia 9
Expected
7 sam 0 8 tia 9
Explanation
Only two orders were logged all morning, which is fewer than three, so the entire log is printed unchanged: ticket 7 (sam, 0 items) then ticket 8 (tia, 9 items).
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →