// editor5
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        sc.nextLine();
        if(n < 0) {
            System.out.println("Invalid input");
            return;
        }
        
        Map<String, Integer> map = new HashMap<>();
        
        for(int i = 0; i<n; i++) {
            if (str.length < 2) {
                System.out.println("Invalid input");
                return;
            }
            try {
                map.put(str[0], Integer.parseInt(str[1]));
            } catch (NumberFormatException e) {
                System.out.println("Invalid input");
                return;
            }
        }
        
        String rem = sc.nextLine();
        
        if(map.containsKey(rem)) {
            map.remove(rem);
            for(Map.Entry entry : map.entrySet()) {
                System.out.print(entry.getKey() + " " + entry.getValue() + "\n");
            }
        } else {
            System.out.println("-1");
        }
    }
}