// Задача "Ничего и не терялось"
// 8-ая Интернет-олимпиада сезона 2006-2007, базовый уровень
// Автор задачи: Федор Царев, tsarev@rain.ifmo.ru
// Автор решения: Федор Царев, tsarev@rain.ifmo.ru

import java.io.*;
import java.util.*;

public class giggle_ft implements Runnable {

	private BufferedReader in;
	private PrintWriter out;

	HashMap<String, TreeSet<String>> word2site = new HashMap<String, TreeSet<String>>();
	HashMap<String, HashSet<String>> site2word = new HashMap<String, HashSet<String>>();

	boolean add(String site, String keyword) {
		HashSet<String> hs = site2word.get(site);
		TreeSet<String> ts = word2site.get(keyword);
		if (hs == null) {
			hs = new HashSet<String>();
			site2word.put(site, hs);
		}
		if (ts == null) {
			ts = new TreeSet<String>();
			word2site.put(keyword, ts);
		}
		if (hs.contains(keyword)) {
			return false;
		}
        hs.add(keyword);
        ts.add(site);
        return true;
	}

	boolean remove(String site, String keyword) {
		HashSet<String> hs = site2word.get(site);
		TreeSet<String> ts = word2site.get(keyword);
		if (hs == null) {
			return false;
		}
		if (ts == null) {
			return false;
		}
		hs.remove(keyword);
		ts.remove(site);
		return true;
		
	}

	private void myAssert(boolean e, String s) {
		if (!e) {
			throw new Error("Assertion failure!!!");
		}
	}

	private void solve() throws IOException {
		int n = Integer.parseInt(in.readLine());
        for (int j = 0; j < n; j++) {
            StringTokenizer st = new StringTokenizer(in.readLine());
            String cmd = st.nextToken();
            if (cmd.equals("Add")) {
                myAssert(st.nextToken().equals("keyword"), "Add-format damaged");

                String keyword = st.nextToken();
                myAssert(keyword.charAt(0) == '"' && keyword.charAt(keyword.length() - 1) == '"' && keyword.length() > 2, "Wrong keyword input: " + keyword);

                myAssert(st.nextToken().equals("to"), "Add-format damaged");

                String site = st.nextToken();
                myAssert(!st.hasMoreTokens(), "Extra tokens");

                boolean reply = add(site, keyword);

                out.println(reply ? "OK" : "Already exists");
            } else if (cmd.equals("Remove")) {
                myAssert(st.nextToken().equals("keyword"), "Remove-format damaged");

                String keyword = st.nextToken();
                myAssert(keyword.charAt(0) == '"' && keyword.charAt(keyword.length() - 1) == '"' && keyword.length() > 2, "Wrong keyword input: " + keyword);

                myAssert(st.nextToken().equals("from"), "Remove-format damaged");

                String site = st.nextToken();
                myAssert(!st.hasMoreTokens(), "Extra tokens");

                boolean reply = remove(site, keyword);

                out.println(reply ? "OK" : "Not found");
            } else if (cmd.equals("Search")) {
                String keyword = st.nextToken();
                myAssert(keyword.charAt(0) == '"' && keyword.charAt(keyword.length() - 1) == '"' && keyword.length() > 2, "Wrong keyword input: " + keyword);
                myAssert(!st.hasMoreTokens(), "Extra tokens");
           		TreeSet<String> ts = word2site.get(keyword);
              	if (ts == null) {
	                out.println("Results: 0 site(s) found");
              	} else {
              		int cnt = 1;
              		out.println("Results: " + ts.size() + " site(s) found");
              		for (String s : ts) {
              			if (cnt > 10) break;
              			out.println(cnt + ") " + s);
              			cnt++;
              		}
              	}
            } else myAssert(false, "Unknown option: " + cmd);
            if (j != n - 1) {
                out.println("=====");
            }
        }
	}

	public void run() {
		try {
			solve();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		} finally {
			out.close();
		}
	}
	
	private giggle_ft(String name) {
		try {
			in = new BufferedReader(new FileReader(name + ".in"));
			out = new PrintWriter(new FileWriter(name + ".out"));	
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(239);
		}
	}

	public static void main(String[] args) {
		(new Thread(new giggle_ft("giggle"))).start();
	}
}
