import java.util.*;

public class ProductCatalog {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        // Read n
        if (!sc.hasNextInt()) {
            System.out.println("Invalid input");
            return;
        }
        int n = sc.nextInt();
        sc.nextLine(); // consume newline

        // If n is invalid or empty catalog
        if (n <= 0 || n > 100) {
            System.out.println("Invalid input");
            return;
        }

        Map<String, Integer> catalog = new LinkedHashMap<>();

        for (int i = 0; i < n; i++) {
            if (!sc.hasNext()) {
                System.out.println("Invalid input");
                return;
            }
            String product = sc.next();

            if (!sc.hasNextInt()) {
                System.out.println("Invalid input");
                return;
            }
            int price = sc.nextInt();

            catalog.put(product, price);
        }

        // Read product to remove
        if (!sc.hasNext()) {
            System.out.println("Invalid input");
            return;
        }
        String removeProduct = sc.next();

        // If product doesn’t exist
        if (!catalog.containsKey(removeProduct)) {
            System.out.println("-1");
            return;
        }

        // Remove product
        catalog.remove(removeProduct);

        // Print remaining products
        for (Map.Entry<String, Integer> entry : catalog.entrySet()) {
            System.out.println(entry.getKey() + " " + entry.getValue());
        }
    }
}
