#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10, SQ = 700, MAX = (1 << 14) + 10;
int cnt[SQ + 10][MAX], lz[SQ + 10];
vector<int> vec;
struct solver {
  vector<int> arr;
  vector<pair<int, int> > qur;
  vector<pair<int, int> > ans;
  void solve() {
    int n = int((arr).size()), num = 0;
    for (int i = 0; i < n; i++) {
      arr[i] ^= i == 0 ? 0 : arr[i - 1];
      num += arr[i] == 0;
    }
    ans.push_back({num, arr[n - 1] != 0});
    for (int l = 0; l < int((qur).size()); l += SQ) {
      vec.clear();
      int r = min(l + SQ, int((qur).size()));
      for (int i = l; i < r; i++) {
        vec.push_back(qur[i].first);
      }
      vec.push_back(0);
      sort(vec.begin(), vec.end());
      vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
      int pt = 0;
      for (int i = 0; i < n; i++) {
        while (pt + 1 < int((vec).size()) && vec[pt + 1] <= i) pt++;
        cnt[pt][arr[i]]++;
        lz[pt] = 0;
      }
      for (int i = l; i < r; i++) {
        for (int j = lower_bound(vec.begin(), vec.end(), qur[i].first) -
                     vec.begin();
             j < int((vec).size()); j++) {
          lz[j] ^= qur[i].second;
        }
        int num = 0;
        for (int j = 0; j < int((vec).size()); j++) {
          num += cnt[j][lz[j]];
        }
        ans.push_back({num, arr[n - 1] != lz[int((vec).size()) - 1]});
      }
      pt = 0;
      for (int i = 0; i < n; i++) {
        while (pt + 1 < int((vec).size()) && vec[pt + 1] <= i) pt++;
        cnt[pt][arr[i]]--;
        arr[i] ^= lz[pt];
      }
    }
    for (int i = int((ans).size()) - 1; i > 0; i--) {
      ans[i].first -= ans[i - 1].first;
      ans[i].second -= ans[i - 1].second;
    }
  }
};
solver slv[maxn];
int a[maxn], b[maxn];
pair<int, int> toask[maxn][2];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie();
  int n, k, q;
  cin >> n >> k >> q;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (int i = 0; i <= n; i++) {
    slv[i % k].arr.push_back(a[i] ^ b[i] ^ (i == 0 ? 0 : a[i - 1] ^ b[i - 1]));
  }
  for (int i = 0; i < q; i++) {
    char ch;
    int pos, y, x = 0;
    cin >> ch >> pos >> y;
    pos--;
    if (ch == 'a')
      x = a[pos] ^ y, a[pos] = y;
    else
      x = b[pos] ^ y, b[pos] = y;
    int r = pos % k;
    slv[r].qur.push_back({pos / k, x});
    toask[i][0] = {r, int((slv[r].qur).size())};
    r = (++pos) % k;
    slv[r].qur.push_back({pos / k, x});
    toask[i][1] = {r, int((slv[r].qur).size())};
  }
  int ans = 0, bad = 0;
  for (int i = 0; i < k; i++) {
    slv[i].solve();
    ans += slv[i].ans[0].first;
    bad += slv[i].ans[0].second;
  }
  if (bad == 0)
    cout << n + 1 - ans << "\n";
  else
    cout << -1 << "\n";
  for (int i = 0; i < q; i++) {
    for (int j = 0; j < 2; j++) {
      pair<int, int> p = toask[i][j];
      ans += slv[p.first].ans[p.second].first;
      bad += slv[p.first].ans[p.second].second;
    }
    if (bad == 0)
      cout << n + 1 - ans << "\n";
    else
      cout << -1 << "\n";
  }
  return 0;
}
