#include <bits/stdc++.h>
using namespace std;
const int X = 50000 + 5;
int on[X], F[X];
unordered_set<int> S[X];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(12);
  int n, m, q, u, v, x, o;
  char com;
  cin >> n >> m >> q >> o;
  while (o--) {
    cin >> x;
    on[x] = 1;
  }
  while (m--) {
    cin >> u >> v;
    if ((int)S[u].size() > (int)S[v].size()) {
      S[v].insert(u);
      F[u] += on[v];
    } else {
      S[u].insert(v);
      F[v] += on[u];
    }
  }
  while (q--) {
    cin >> com >> u;
    if (com == 'O') {
      on[u] = 1;
      for (auto it : S[u]) {
        F[it]++;
      }
    } else if (com == 'F') {
      on[u] = 0;
      for (auto it : S[u]) {
        F[it]--;
      }
    } else if (com == 'A') {
      cin >> v;
      if ((int)S[u].size() > (int)S[v].size()) {
        S[v].insert(u);
        F[u] += on[v];
      } else {
        S[u].insert(v);
        F[v] += on[u];
      }
    } else if (com == 'D') {
      cin >> v;
      if (S[u].find(v) != S[u].end()) {
        S[u].erase(v);
        F[v] -= on[u];
      } else {
        S[v].erase(u);
        F[u] -= on[v];
      }
    } else {
      int c = F[u];
      for (auto it : S[u]) {
        c += on[it];
      }
      cout << c << '\n';
    }
  }
  return 0;
}
