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;
long double typedef ld;
unsigned int typedef ui;
long long int typedef li;
pair<int, int> typedef pii;
pair<li, li> typedef pli;
vector<vector<int>> typedef graph;
unsigned long long int typedef ull;
const ld PI = 3.14159265359;
const int mod = 1000000007;
const li inf = 4000000000000000001ll;
inline int power(li _a, int _n) {
  li _c = 1;
  while (_n > 0) {
    if (_n % 2) _c = _c * _a % mod;
    _a = _a * _a % mod;
    _n /= 2;
  }
  return _c;
}
inline int geom(li _a, int _n) {
  if (_a == 0) return 0;
  if (_a == 1) return _n;
  return ((li)power(_a, _n) - 1) * power((_a - 1), mod - 2) % mod;
}
pli _r;
li bigmod(li _a, li _b, li _m) {
  if (_a == 0) return 0;
  if (_a % 2 == 1) return (_b + 2 * bigmod(_a / 2, _b, _m)) % _m;
  return 2 * bigmod(_a / 2, _b, _m) % _m;
}
void euklid(li _a, li _b) {
  if (_b == 1) {
    _r = make_pair(1, -_a + 1);
    return;
  }
  euklid(_b, _a % _b);
  _r = make_pair(_r.second, _r.first - _r.second * (_a / _b));
}
li kinez(li _x, li _a, li _y, li _b) {
  if (_x == _y) return _x;
  if (_a > _b) {
    swap(_a, _b);
    swap(_x, _y);
  }
  euklid(_b, _a);
  (_r.first *= (_x - _y)) %= (_a * _b);
  return (bigmod(_b, _r.first, _a * _b) + _y) % (_a * _b);
}
inline li sum(int _n) { return ((li)_n * (_n + 1)) / 2; }
inline li kv(int _n) { return ((li)_n * (_n + 1) * (2 * _n + 1)) / 6; }
int k = 1;
int l[2000004];
int r[2000004];
int val1[2000004];
int val2[2000004];
void make(int p, int ll, int rr) {
  l[p] = ll;
  r[p] = rr;
  if (p >= k) return;
  make(2 * p, ll, ll + (rr - ll) / 2);
  make(2 * p + 1, ll + (rr - ll) / 2 + 1, rr);
}
void app1(int v, int p) {
  while (p) {
    val1[p] = max(v, val1[p]);
    p /= 2;
  }
}
void app2(int v, int p) {
  while (p) {
    val2[p] = min(v, val2[p]);
    p /= 2;
  }
}
int ll, rr;
int maxi(int p) {
  if (rr < l[p]) return -mod;
  if (ll > r[p]) return -mod;
  if (ll <= l[p] && rr >= r[p]) return val1[p];
  return max(maxi(2 * p), maxi(2 * p + 1));
}
int mini(int p) {
  if (rr < l[p]) return mod;
  if (ll > r[p]) return mod;
  if (ll <= l[p] && rr >= r[p]) return val2[p];
  return min(mini(2 * p), mini(2 * p + 1));
}
int main() {
  bool okidac = false;
  int n, m, q, y, x;
  cin >> n >> m >> q;
  n *= 2;
  m *= 2;
  while (k <= n) k *= 2;
  for (int(i) = (1); (i) < (2 * k); (i)++) val2[i] = mod;
  make(1, 1, k);
  while (q--) {
    cin >> y >> x;
    if (y % 2 == 0) {
      app1(x, k + y - 1);
      ll = 1;
      rr = y;
      if (mini(1) < x) okidac = true;
    } else {
      app2(x, k + y - 1);
      ll = y;
      rr = n;
      if (maxi(1) > x) okidac = true;
    }
    if (okidac)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
}