Problem: Note that the difference between easy and hard versions is that in hard version unavailable cells can become available again and in easy version can't. You can make hacks only if all versions are solved.

Ildar and Ivan are tired of chess, but they really like the chessboard, so they invented a new game. The field is a chessboard 2n × 2m: it has 2n rows, 2m columns, and the cell in row i and column j is colored white if i+j is even, and is colored black otherwise.

The game proceeds as follows: Ildar marks some of the white cells of the chessboard as unavailable, and asks Ivan to place n × m kings on the remaining white cells in such way, so that there are no kings attacking each other. A king can attack another king if they are located in the adjacent cells, sharing an edge or a corner.

Ildar would like to explore different combinations of cells. Initially all cells are marked as available, and then he has q queries. In each query he marks a cell as unavailable. After each query he would like to know whether it is possible to place the kings on the available cells in a desired way. Please help him!

Input

The first line of input contains three integers n, m, q (1 ≤ n, m, q ≤ 200 000) — the size of the board and the number of queries.

q lines follow, each of them contains a description of a query: two integers i and j, denoting a white cell (i, j) on the board (1 ≤ i ≤ 2n, 1 ≤ j ≤ 2m, i + j is even) that becomes unavailable. It's guaranteed, that each cell (i, j) appears in input at most once.

Output

Output q lines, i-th line should contain answer for a board after i queries of Ildar. This line should contain "YES" if it is possible to place the kings on the available cells in the desired way, or "NO" otherwise.

Examples

Input


1 3 3
1 1
1 5
2 4


Output


YES
YES
NO


Input


3 2 7
4 2
6 4
1 3
2 2
2 4
4 4
3 1


Output


YES
YES
NO
NO
NO
NO
NO

Note

In the first example case after the second query only cells (1, 1) and (1, 5) are unavailable. Then Ivan can place three kings on cells (2, 2), (2, 4) and (2, 6).

After the third query three cells (1, 1), (1, 5) and (2, 4) are unavailable, so there remain only 3 available cells: (2, 2), (1, 3) and (2, 6). Ivan can not put 3 kings on those cells, because kings on cells (2, 2) and (1, 3) attack each other, since these cells share a corner.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int first = 0;
  cerr << '{';
  for (auto &i : x) cerr << (first++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
const long long INF = 9e18;
long long mod = 1000000007;
inline long long fast_expo(long long base, long long power,
                           long long modulo = mod) {
  base %= modulo;
  if (base < 0) base += modulo;
  long long x = base, cnt = power, ans = 1;
  while (cnt) {
    if (cnt & 1) ans = (ans * x) % modulo;
    x = (x * x) % modulo;
    cnt >>= 1;
  }
  return ans;
}
long long takemod(long long a, long long mo) {
  a %= mo;
  if (a < 0) a += mo;
  return a;
}
long long modinv(long long a, long long mo) {
  return takemod(fast_expo(takemod(a, mo), mo - 2, mo), mo);
}
const int nax = 4e5 + 5;
set<int> typea[nax];
set<int> typeb[nax];
struct Segtree {
  int siz;
  vector<long long> rowa;
  vector<long long> rowb;
  vector<long long> isbad;
  vector<long long> lo;
  vector<long long> hi;
  Segtree(int n) {
    siz = 4 * n;
    rowa.resize(siz + 1);
    rowb.resize(siz + 1);
    isbad.resize(siz + 1);
    lo.resize(siz + 1);
    hi.resize(siz + 1);
    build(1, n, 1);
  }
  void build(long long l, long long r, long long idx) {
    lo[idx] = l, hi[idx] = r;
    if (l == r) {
      rowa[idx] = INF;
      rowb[idx] = 0;
      isbad[idx] = 0;
      return;
    }
    long long mid = (l + r) / 2;
    build(l, mid, 2 * idx);
    build(mid + 1, r, 2 * idx + 1);
    merge(idx);
  }
  void update(long long idx, long long pos, long long val) {
    if (hi[idx] < pos || lo[idx] > pos) {
      return;
    }
    if (lo[idx] == hi[idx]) {
      if ((int)typea[pos].size())
        rowa[idx] = *typea[pos].begin();
      else
        rowa[idx] = INF;
      if ((int)typeb[pos].size())
        rowb[idx] = *typeb[pos].rbegin();
      else
        rowb[idx] = 0;
      isbad[idx] = rowb[idx] >= rowa[idx];
      return;
    }
    update(2 * idx, pos, val);
    update(2 * idx + 1, pos, val);
    merge(idx);
  }
  long long query(long long idx, long long l, long long r) {
    if (hi[idx] < l || lo[idx] > r) {
      return 0;
    }
    if (l <= lo[idx] && hi[idx] <= r) {
      return isbad[idx];
    }
    long long Left = query(2 * idx, l, r);
    long long Right = query(2 * idx + 1, l, r);
    return Left | Right;
  }
  void merge(long long idx) {
    isbad[idx] = isbad[2 * idx] | isbad[2 * idx + 1];
    rowb[idx] = max(rowb[2 * idx], rowb[2 * idx + 1]);
    rowa[idx] = min(rowa[2 * idx], rowa[2 * idx + 1]);
    isbad[idx] |= rowb[2 * idx + 1] >= rowa[2 * idx];
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m, q;
  cin >> n >> m >> q;
  Segtree segtree(n);
  while (q--) {
    long long x, y;
    cin >> x >> y;
    if (x & 1) {
      if (typea[(x + 1) / 2].count(y)) {
        typea[(x + 1) / 2].erase(y);
        segtree.update(1, (x + 1) / 2, 314159265358979);
      } else {
        typea[(x + 1) / 2].insert(y);
        segtree.update(1, (x + 1) / 2, 314159265358979);
      }
    } else {
      if (typeb[x / 2].count(y)) {
        typeb[x / 2].erase(y);
        segtree.update(1, x / 2, 314159265358979);
      } else {
        typeb[x / 2].insert(y);
        segtree.update(1, x / 2, 314159265358979);
      }
    }
    cout << (segtree.query(1, 1, 2 * n) ? "NO" : "YES") << "\n";
  }
  return 0;
}