#if __INCLUDE_LEVEL__ == 0

#include <bits/stdc++.h>

using namespace std;

#undef assert
#define assert(expr) (expr) || (__builtin_unreachable(), 0)

#include __BASE_FILE__

namespace std::ranges::views {

namespace {

void solve() {
  int n, m, q;
  cin >> tie(n, m, q);
  vector<int> p(n);
  vector<string> s(n);
  for (int i : iota(0, n)) {
    cin >> tie(p[i], s[i]);
    --p[i];
  }
  vector<int> l(q), r(q);
  for (int id : iota(0, q)) {
    cin >> tie(l[id], r[id]);
    --l[id];
  }
  vector<vector<int>> lst(m);
  for (int i : iota(0, n)) {
    lst[p[i]].push_back(i);
  }
  vector<pair<int, int>> ans(q);
  vector<vector<int>> ids(m);
  for (int id : iota(0, q)) {
    ids[l[id]].push_back(id);
  }
  atcoder::fenwick_tree<int> f_ac(n);
  atcoder::fenwick_tree<int> f_wa(n);
  vector<int> memo(n);
  for (int x : iota(0, m)) {
    int pos = -1;
    for (int i : lst[x]) {
      if (s[i] == "AC") {
        pos = i;
        break;
      }
    }
    if (~pos) {
      for (int i : lst[x]) {
        if (i == pos) {
          f_ac.add(pos, 1);
          break;
        } else {
          memo[i] = pos;
          f_wa.add(pos, 1);
        }
      }
    }
  }
  for (int L : iota(0, n)) {
    for (int id : ids[L]) {
      ans[id] = {f_ac.sum(l[id], r[id]), f_wa.sum(l[id], r[id])};
    }
    if (s[L] == "AC") {
      int pos = -1;
      for (auto it = upper_bound(lst[p[L]], L); it != lst[p[L]].end(); ++it) {
        if (s[*it] == "AC") {
          pos = *it;
          break;
        }
      }
      if (~pos) {
        for (auto it = upper_bound(lst[p[L]], L); it != lst[p[L]].end(); ++it) {
          if (*it == pos) {
            f_ac.add(pos, 1);
            break;
          } else {
            memo[*it] = pos;
            f_wa.add(pos, 1);
          }
        }
      }
    } else {
      f_wa.add(memo[L], -1);
    }
  }
  for (auto e : ans) {
    cout << e << '\n';
  }
}

}  // namespace

}  // namespace std::ranges::views

using views::solve;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
}

#else  // __INCLUDE_LEVEL__

#include <atcoder/fenwicktree>

namespace std {

template <class T1, class T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
  return is >> p.first >> p.second;
}

template <class... Ts>
istream& operator>>(istream& is, tuple<Ts...>& t) {
  return apply([&is](auto&... xs) -> istream& { return (is >> ... >> xs); }, t);
}

template <class... Ts>
istream& operator>>(istream& is, tuple<Ts&...>&& t) {
  return is >> t;
}

template <class R, enable_if_t<!is_convertible_v<R, string>>* = nullptr>
auto operator>>(istream& is, R&& r) -> decltype(is >> *begin(r)) {
  for (auto&& e : r) {
    is >> e;
  }
  return is;
}

template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
  return os << p.first << ' ' << p.second;
}

template <class... Ts>
ostream& operator<<(ostream& os, const tuple<Ts...>& t) {
  auto f = [&os](const auto&... xs) -> ostream& {
    [[maybe_unused]] auto sep = "";
    ((os << exchange(sep, " ") << xs), ...);
    return os;
  };
  return apply(f, t);
}

template <class R, enable_if_t<!is_convertible_v<R, string_view>>* = nullptr>
auto operator<<(ostream& os, R&& r) -> decltype(os << *begin(r)) {
  auto sep = "";
  for (auto&& e : r) {
    os << exchange(sep, " ") << e;
  }
  return os;
}

}  // namespace std

#endif  // __INCLUDE_LEVEL__