#C3512. Unique Delivery Schedule

    ID: 46948 Type: Default 1000ms 256MiB

Unique Delivery Schedule

Unique Delivery Schedule

In this problem, you are given a list of customer requests. Each request consists of a customer name and a food item. A customer may submit multiple requests, but only the first request for each customer should be considered. Your task is to generate a delivery schedule that contains each customer exactly once with their first requested food item, and then output this schedule in lexicographical order by customer name.

Formally, if the sequence of requests is given by ( (c_i, f_i) ) for ( i=1,2,\dots,N ), then for each customer ( c ), only the food item corresponding to the smallest index ( i ) such that ( c_i = c ) should be selected. The final schedule should be sorted in ascending order by customer name.

inputFormat

The first line of input contains an integer ( N ), the number of customer requests. Each of the following ( N ) lines contains two space-separated strings: the customer name and the food item.

outputFormat

Output the delivery schedule sorted in lexicographical order by customer name. Each line should contain the customer name and the corresponding food item separated by a space.## sample

8
john pizza
alice burger
john pasta
maria salad
peter sushi
alice fries
maria soup
peter tempura
alice burger

john pizza maria salad peter sushi

</p>