#include <bits/stdc++.h>
#include "testlib.h"

using namespace std;

int minN = 1, maxN = 1e5;
int minM = 1, maxM = 1e5;
int minA = 1, maxA = 1e9;

int main(int argc, char* argv[]) {
    registerValidation(argc, argv);
    int n = inf.readInt(minN, maxN, "n");
    inf.readSpace();
    int m = inf.readInt(minM, maxM, "m");
    inf.readEoln();
    set<int> st;
    for (int i = 0; i < n; i++) {
        int a = inf.readInt(minA, maxA, "a");
        if (i == n - 1)
            inf.readEoln();
        else
            inf.readSpace();
        st.insert(a);
    }
    inf.ensuref((int)st.size() == n, "a is unique");
    for (int i = 0; i < m; i++) {
        int t = inf.readInt(1, 3, "t");
        inf.readSpace();
        if (t == 1) {
            int x = inf.readInt(minA, maxA, "x");
            inf.readSpace();
            int y = inf.readInt(minA, maxA, "y");
            inf.ensuref(st.count(x) == 0, "x is already in list");
            inf.ensuref(st.count(y) == 1, "y is not in list");
            st.insert(x);
            inf.readEoln();
        }
        if (t == 2) {
            int x = inf.readInt(minA, maxA, "x");
            inf.ensuref(st.count(x) == 0, "xx is already in list");
            st.insert(x);
            inf.readEoln();
        }
        if (t == 3) {
            int x = inf.readInt(minA, maxA, "x");
            inf.ensuref(st.count(x) == 1, "x is not in list");
            st.erase(x);
            inf.readEoln();
        }
    }
    inf.readEof();
}
