#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

struct Fast
{
  Fast()
  {
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;

#define rep(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (int)(b)-1; i >= (a); i--)
#define Yn(b) cout << ((b) ? "Yes" : "No") << "\n";
#define ll long long

template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}

struct Mo {
  int width;
  vector<int> left, right, order;

  Mo(int N, int Q) : order(Q) {
    width = max<int>(1, 1.0 * N / max<double>(1.0, sqrt(Q * 2.0 / 3.0)));
    iota(begin(order), end(order), 0);
  }

  void insert(int l, int r) { /* [l, r) */
    left.emplace_back(l);
    right.emplace_back(r);
  }

  template <typename AL, typename AR, typename DL, typename DR, typename REM>
  void run(const AL &add_left, const AR &add_right, const DL &delete_left,
           const DR &delete_right, const REM &rem) {
    assert(left.size() == order.size());
    sort(begin(order), end(order), [&](int a, int b) {
      int ablock = left[a] / width, bblock = left[b] / width;
      if (ablock != bblock) return ablock < bblock;
      if (ablock & 1) return right[a] < right[b];
      return right[a] > right[b];
    });
    int nl = 0, nr = 0;
    for (auto idx : order) {
      while (nl > left[idx]) add_left(--nl);
      while (nr < right[idx]) add_right(nr++);
      while (nl < left[idx]) delete_left(nl++);
      while (nr > right[idx]) delete_right(--nr);
      rem(idx);
    }
  }
};

const int sz = 200000;
int p[sz], ac[sz], point[sz], pena[sz], accnt[sz];
deque<int> wadeq[sz];

int main()
{
  int n, m, q;
  cin >> n >> m >> q;
  rep(i, 0, n)
  {
    string s = "";
    cin >> p[i] >> s;
    p[i]--;
    ac[i] = s == "AC";
  }

  Mo mo(n, q);
  rep(i, 0, q)
  {
    int l, r;
    cin >> l >> r;
    mo.insert(l - 1, r);
  }
  rep(i, 0, sz) wadeq[i] = {0};
  int pt = 0, pn = 0;
  auto add_left = [&](int i)
  {
    int x = p[i];
    if (ac[i])
    {
      if (accnt[x]++ == 0)
      {
        pt++;
      }
      else
      {
        pn -= wadeq[x].front();
      }
      wadeq[x].push_front(0);
    }
    else
    {
      if (accnt[x])
      {
        pn++;
      }
      wadeq[x].front()++;
    }
  };
  auto add_right = [&](int i)
  {
    int x = p[i];
    if (ac[i])
    {
      if (accnt[x]++ == 0)
      {
        pt++;
        pn += wadeq[x].front();
      }
      wadeq[x].push_back(0);
    }
    else
    {
      wadeq[x].back()++;
    }
  };
  auto erase_left = [&](int i)
  {
    int x = p[i];
    if (ac[i])
    {
      wadeq[x].pop_front();
      if (--accnt[x] == 0)
      {
        pt--;
      }
      else
      {
        pn += wadeq[x].front();
      }
    }
    else
    {
      if (accnt[x])
      {
        pn--;
      }
      wadeq[x].front()--;
    }
  };
  auto erase_right = [&](int i)
  {
    int x = p[i];
    if (ac[i])
    {
      wadeq[x].pop_back();
      if (--accnt[x] == 0)
      {
        pt--;
        pn -= wadeq[x].front();
      }
    }
    else
    {
      wadeq[x].back()--;
    }
  };
  auto out = [&](int i)
  {
    point[i] = pt;
    pena[i] = pn;
  };

  mo.run(add_left, add_right, erase_left, erase_right, out);
  rep(i, 0, q) cout << point[i] << " " << pena[i] << "\n";
}