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 JAVA):

Solution:
import java.io.*; 
import java.text.*; 
import java.util.*; 
import java.math.*;
public class template { 
    public static void main(String[] args) throws Exception {
        new template().run();
    } 
    public void run() throws Exception { 
        FastScanner f = new FastScanner(); 
        PrintWriter out = new PrintWriter(System.out); 
        int n = f.nextInt(), m = f.nextInt(), q = f.nextInt();
        ok = new boolean[800000];
        up = new int[800000];
        down = new int[800000];
        init(0, 0, n);
        TreeSet<Integer>[] up = new TreeSet[n];
        TreeSet<Integer>[] down = new TreeSet[n];
        for(int i = 0; i < n; i++) up[i] = new TreeSet<>();
        for(int i = 0; i < n; i++) down[i] = new TreeSet<>();
        for(int i = 0; i < n; i++) {
            up[i].add(200001);
            down[i].add(-1);
        }
        while(q-->0) {
            int r = f.nextInt()-1, c = f.nextInt()-1;
            if(r % 2 == 1) {
                if(!down[r/2].add(c/2))
                    down[r/2].remove(c/2);
                update(0, 0, n, r/2, down[r/2].last(), true);
            } else {
                if(!up[r/2].add(c/2))
                    up[r/2].remove(c/2);
                update(0, 0, n, r/2, up[r/2].first(), false);
            }
            out.println(ok[0] ? "YES" : "NO");
        }
        ///
///
		out.flush();
	}
    public void init(int i, int l, int r) {
        if(l != r-1) {
            int m = (l+r)/2;
            init(2*i+1, l, m);
            init(2*i+2, m, r);
        }
        ok[i] = true;
        up[i] = 200001;
        down[i] = -1;
    }
    boolean[] ok;
    int[] up, down;
    public void update(int i, int l, int r, int qi, int qv, boolean b) {
        if(qi >= r || qi < l) return;
        if(l == r-1) {
            if(b) down[i] = qv;
            else up[i] = qv;
            ok[i] = up[i] > down[i];
        } else {
            int m = (l+r)/2;
            update(2*i+1, l, m, qi, qv, b);
            update(2*i+2, m, r, qi, qv, b);
            up[i] = Math.min(up[2*i+1], up[2*i+2]);
            down[i] = Math.max(down[2*i+1], down[2*i+2]);
            ok[i] = ok[2*i+1] && ok[2*i+2] && up[2*i+1] > down[2*i+2];
        }
    }
///
	static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}
		public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch(IOException e) {
				throw new RuntimeException(e);
			}
		}
	}
}