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>
using namespace std;
const long long INF = 9223372036854775807;
const long long MOD = 1000000007;
const long double PI = acos(-1);
long long power(long long a, long long b, long long z = MOD) {
  long long res = 1;
  a = (a % z);
  while (b) {
    if (b & 1) res = (res * a) % z;
    a = (a * a) % z;
    b = b >> 1;
  }
  return res;
}
long long inverse(long long a, long long z = MOD) { return power(a, z - 2, z); }
long long extend(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long x1, y1;
  long long g = extend(b, a % b, x1, y1);
  x = y1;
  y = x1 - (a / b) * y1;
  return g;
}
long long mat_power(long long a, long long b, long long c, long long d,
                    long long n, long long z = MOD) {
  long long a0 = 1, b0 = 0, c0 = 0, d0 = 1;
  while (n) {
    if (n & 1) {
      long long a1 = a0, b1 = b0, c1 = c0, d1 = d0;
      a0 = (a1 * a + b1 * c) % z;
      b0 = (a1 * b + b1 * d) % z;
      c0 = (c1 * a + d1 * c) % z;
      d0 = (c1 * b + d1 * d) % z;
    }
    long long a1 = a, b1 = b, c1 = c, d1 = d;
    a = (a1 * a1 + b1 * c1) % z;
    b = (a1 * b1 + b1 * d1) % z;
    c = (c1 * a1 + d1 * c1) % z;
    d = (c1 * b1 + d1 * d1) % z;
    n = n >> 1;
  }
  return c0;
}
int even[200001], odd[200001];
int tree[800005][2];
void build(int node, int l, int r) {
  if (l == r) {
    tree[node][0] = even[l];
    tree[node][1] = odd[l];
  } else {
    int mid = (l + r) >> 1;
    build(2 * node, l, mid);
    build(2 * node + 1, mid + 1, r);
    tree[node][0] = max(tree[2 * node][0], tree[2 * node + 1][0]);
    tree[node][1] = min(tree[2 * node][1], tree[2 * node + 1][1]);
  }
  return;
}
void update(int node, int l, int r, int ind, int val, int loc) {
  if (ind < l || ind > r) return;
  if (l == r) {
    tree[node][loc] = val;
    return;
  }
  int mid = (l + r) >> 1;
  update(2 * node, l, mid, ind, val, loc);
  update(2 * node + 1, mid + 1, r, ind, val, loc);
  if (loc == 0)
    tree[node][loc] = max(tree[2 * node + 1][loc], tree[2 * node][loc]);
  else
    tree[node][loc] = min(tree[2 * node + 1][loc], tree[2 * node][loc]);
  return;
}
int query(int node, int l, int r, int left, int right, int loc) {
  if (r < left || right < l) {
    if (loc == 0) return 0;
    return 100000000;
  }
  if (left <= l && r <= right) return tree[node][loc];
  int mid = (l + r) >> 1;
  if (loc == 0)
    return max(query(2 * node, l, mid, left, right, loc),
               query(2 * node + 1, mid + 1, r, left, right, loc));
  if (loc == 1)
    return min(query(2 * node, l, mid, left, right, loc),
               query(2 * node + 1, mid + 1, r, left, right, loc));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 0; i <= n; i++) {
    even[i] = 0;
    odd[i] = 2 * m + 1;
  }
  build(1, 1, n);
  bool ans = true;
  while (q--) {
    int x, y;
    cin >> x >> y;
    int num = (x + 1) >> 1;
    if (x & 1) {
      odd[num] = min(odd[num], y);
      update(1, 1, n, num, odd[num], 1);
    } else {
      even[num] = max(even[num], y);
      update(1, 1, n, num, even[num], 0);
    }
    int val0 = query(1, 1, n, num, n, 0);
    int val1 = query(1, 1, n, 1, num, 1);
    if (odd[num] < val0) ans = false;
    if (even[num] > val1) ans = false;
    if (ans)
      cout << "YES"
           << "\n";
    else
      cout << "NO"
           << "\n";
  }
  return 0;
}