Bob has a rectangular chocolate bar of the size W × H. He introduced a cartesian coordinate system so that the point (0, 0) corresponds to the lower-left corner of the bar, and the point (W, H) corresponds to the upper-right corner. Bob decided to split the bar into pieces by breaking it. Each break is a segment parallel to one of the coordinate axes, which connects the edges of the bar. More formally, each break goes along the line x = xc or y = yc, where xc and yc are integers. It should divide one part of the bar into two non-empty parts. After Bob breaks some part into two parts, he breaks the resulting parts separately and independently from each other. Also he doesn't move the parts of the bar. Bob made n breaks and wrote them down in his notebook in arbitrary order. At the end he got n + 1 parts. Now he wants to calculate their areas. Bob is lazy, so he asks you to do this task.

Input

The first line contains 3 integers W, H and n (1 ≤ W, H, n ≤ 100) — width of the bar, height of the bar and amount of breaks. Each of the following n lines contains four integers xi, 1, yi, 1, xi, 2, yi, 2 — coordinates of the endpoints of the i-th break (0 ≤ xi, 1 ≤ xi, 2 ≤ W, 0 ≤ yi, 1 ≤ yi, 2 ≤ H, or xi, 1 = xi, 2, or yi, 1 = yi, 2). Breaks are given in arbitrary order.

It is guaranteed that the set of breaks is correct, i.e. there is some order of the given breaks that each next break divides exactly one part of the bar into two non-empty parts.

Output

Output n + 1 numbers — areas of the resulting parts in the increasing order.

Examples

Input

2 2 2
1 0 1 2
0 1 1 1


Output

1 1 2 

Input

2 2 3
1 0 1 2
0 1 1 1
1 1 2 1


Output

1 1 1 1 

Input

2 4 2
0 1 2 1
0 3 2 3


Output

2 2 4 
import java.util.List;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.AbstractCollection;
import java.util.StringTokenizer;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Zyflair Griffane
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		PandaScanner in = new PandaScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Chocolate solver = new Chocolate();
		solver.solve(1, in, out);
		out.close();
	}
}

class Chocolate {
    final int[] dx = { -1, 0, 1, 0 };
    final int[] dy = { 0, -1, 0, 1 };
    public void solve(int testNumber, PandaScanner in, PrintWriter out) {
        int w = in.nextInt();
        int h = in.nextInt();
        boolean[][][] adj = new boolean[h][w][4];
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                for (int k = 0; k < 4; k++) {
                    int x = i + dx[k];
                    int y = j + dy[k];
                    adj[i][j][k] = x >= 0 && x < h && y >= 0 && y < w;
                }
            }
        }
        int breaks = in.nextInt();
        for (int b = 0; b < breaks; b++) {
            int y1 = in.nextInt();
            int x1 = in.nextInt();
            int y2 = in.nextInt();
            int x2 = in.nextInt();
            if (y1 == y2) {
                for (int i = Math.min(x1, x2); i < Math.max(x1, x2); i++) {
                    adj[i][y1 - 1][3] = adj[i][y1][1] = false;
                }
            }
            else {
                for (int i = Math.min(y1, y2); i < Math.max(y1, y2); i++) {
                    adj[x1 - 1][i][2] = adj[x1][i][0] = false;
                }
            }
        }
        DisjointSet ds = new DisjointSet(h * w);
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                for (int k = 0; k < 4; k++) {
                    if (adj[i][j][k]) {
                        int curr = i * w + j;
                        ds.union(curr, curr + dy[k] + dx[k] * w);
                    }
                }
            }
        }
        ArrayList<Integer> lst = new ArrayList<>();
        for (int i = 0; i < h * w; i++) {
            if (ds.size[i] > 0) {
                lst.add(ds.size[i]);
            }
        }
        Collections.sort(lst);
        out.println(lst.toString().replaceAll("[^ 0-9]", ""));
    }
}

class PandaScanner {
    public BufferedReader br;
    public StringTokenizer st;
    public InputStream in;

    public PandaScanner(InputStream in) {
        br = new BufferedReader(new InputStreamReader(this.in = in));
    }

    public String nextLine() {
        try {
            return br.readLine();
        }
        catch (Exception e) {
            return null;
        }
    }

    public String next() {
        if (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(nextLine().trim());
            return next();
        }
        return st.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    }

class DisjointSet {
    public int[] par;
    public int[] rank;
    public int[] size;
    int sets;

    public DisjointSet(int n) {
        sets = n;
        par = new int[n];
        rank = new int[n];
        size = new int[n];
        Arrays.fill(size, 1);
        for (int i = 0; i < n; i++) {
            par[i] = i;
        }
    }

    public void union(int u, int v) {
        if (find(u) == find(v)) return;
        sets --;
        if (rank[find(u)] < rank[find(v)]) {
            int t = u;
            u = v;
            v = t;
        }
        size[find(u)] += size[find(v)];
        size[find(v)] = 0;
        par[find(v)] = find(u);
        rank[find(u)] = Math.max(rank[find(u)], rank[find(v)] + 1);
    }

    public int find(int u) {
        if (par[u] == u) {
            return u;
        }
        else {
            par[u] = find(par[u]);
            return par[u];
        }
    }
}

