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.io.*;
import java.math.BigInteger;
import java.util.*;

public class Template implements Runnable {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } catch (Exception e) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }
    }

    class GraphBuilder {
        int n, m;
        int[] x, y;
        int index;
        int[] size;


        GraphBuilder(int n, int m) {
            this.n = n;
            this.m = m;
            x = new int[m];
            y = new int[m];
            size = new int[n];
        }

        void add(int u, int v) {
            x[index] = u;
            y[index] = v;
            size[u]++;
            size[v]++;
            index++;
        }

        int[][] build() {
            int[][] graph = new int[n][];
            for (int i = 0; i < n; i++) {
                graph[i] = new int[size[i]];
            }
            for (int i = index - 1; i >= 0; i--) {
                int u = x[i];
                int v = y[i];
                graph[u][--size[u]] = v;
                graph[v][--size[v]] = u;
            }
            return graph;
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    int[] readIntArray(int size) throws IOException {
        int[] res = new int[size];
        for (int i = 0; i < size; i++) {
            res[i] = readInt();
        }
        return res;
    }

    long[] readLongArray(int size) throws IOException {
        long[] res = new long[size];
        for (int i = 0; i < size; i++) {
            res[i] = readLong();
        }
        return res;
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    <T> List<T>[] createGraphList(int size) {
        List<T>[] list = new List[size];
        for (int i = 0; i < size; i++) {
            list[i] = new ArrayList<>();
        }
        return list;
    }

    public static void main(String[] args) {
        new Template().run();
        // new Thread(null, new Template(), "", 1l * 200 * 1024 * 1024).start();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    long memoryTotal, memoryFree;

    void memory() {
        memoryFree = Runtime.getRuntime().freeMemory();
        System.err.println("Memory = " + ((memoryTotal - memoryFree) >> 10)
                + " KB");
    }

    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            memoryTotal = Runtime.getRuntime().freeMemory();
            init();
            solve();
            out.close();
            if (System.getProperty("ONLINE_JUDGE") == null) {
                time();
                memory();
            }
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    class Rectangle implements Comparable<Rectangle> {

        int minX, minY, maxX, maxY;

        public Rectangle(int x1, int y1, int x2, int y2) {
            this.minX = Math.min(x1, x2);
            this.minY = Math.min(y1, y2);
            this.maxX = Math.max(x1, x2);
            this.maxY = Math.max(y1, y2);
        }

        boolean inside(Cut cut) {
            if (cut.x1 == cut.x2) {
                return cut.x1 >= minX && cut.x1 <= maxX && cut.y1 == minY && cut.y2 == maxY;
            } else {
                return cut.y1 >= minY && cut.y1 <= maxY && cut.x1 == minX && cut.x2 == maxX;
            }
        }

        Rectangle[] split(Cut cut) {
            if (cut.x1 == cut.x2) {
                Rectangle a = new Rectangle(minX, minY, cut.x1, maxY);
                Rectangle b = new Rectangle(cut.x1, minY, maxX, maxY);
                return new Rectangle[]{a, b};
            } else {
                Rectangle a = new Rectangle(minX, minY, maxX, cut.y1);
                Rectangle b = new Rectangle(minX, cut.y1, maxX, maxY);
                return new Rectangle[]{a, b};
            }
        }

        int sq() {
            return (maxX - minX) * (maxY - minY);
        }

        @Override
        public int compareTo(Rectangle o) {
            return sq() - o.sq();
        }
    }

    class Cut {
        int x1, y1, x2, y2;

        public Cut(int x1, int y1, int x2, int y2) {
            this.x1 = Math.min(x1, x2);
            this.y1 = Math.min(y1, y2);
            this.x2 = Math.max(x1, x2);
            this.y2 = Math.max(y1, y2);
        }
    }

    void solve() throws IOException {
        int W = readInt(), H = readInt();
        int n = readInt();
        List<Rectangle> rectangles = new ArrayList<>();
        rectangles.add(new Rectangle(0, 0, W, H));
        List<Cut> cuts = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            cuts.add(new Cut(readInt(), readInt(), readInt(), readInt()));
        }
        while (cuts.size() > 0) {
            Cut selectedCut = null;
            Rectangle rectangle = null;
            for (Cut cut : cuts) {
                for (Rectangle rect : rectangles) {
                    if (rect.inside(cut)) {
                        selectedCut = cut;
                        rectangle = rect;
                    }
                }
            }
            cuts.remove(selectedCut);
            rectangles.remove(rectangle);
            for (Rectangle other : rectangle.split(selectedCut)) {
                rectangles.add(other);
            }
        }

        Collections.sort(rectangles);
        for (Rectangle rectangle : rectangles) {
            out.print(rectangle.sq() + " ");
        }

    }

}