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 javax.annotation.processing.SupportedSourceVersion;
import java.io.*;
import java.util.*;
import java.util.regex.Matcher;

public class Main {

    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(in, out);
        out.close();
    }

    private static class TaskB {

        static final long max = 1000000000000000000L;
        static final double eps = 0.0000001;
        static final long mod = 1000000007;
        static int M, K;
        static long X, Y;
        static List<Block> blocks;
        static boolean V[][];
        static boolean B[][][];
        int W, H, N;

        void solve(InputReader in, PrintWriter out) throws IOException {

            W = in.nextInt();
            H = in.nextInt();
            N = in.nextInt();

            blocks = new ArrayList<>();
            V = new boolean[W + 1][H + 1];
            B = new boolean[W + 1][H + 1][5];

            for (int i = 0; i < N; i++) {

                int X1 = in.nextInt();
                int Y1 = in.nextInt();
                int X2 = in.nextInt();
                int Y2 = in.nextInt();

                if (X1 == X2) {
                    for (int j = Math.min(Y1, Y2) + 1; j <= Math.max(Y1, Y2); j++) {
                        B[X1][j][3] = true;// blocks.add(new Block(new Pair(X1, j), new Pair(X1 + 1, j)));
                        B[X1 + 1][j][1] = true;
                    }
                } else {
                    for (int j = Math.min(X1, X2) + 1; j <= Math.max(X1, X2); j++) {
                        B[j][Y1][4] = true;
                        B[j][Y1 + 1][2] = true;
                        //   blocks.add(new Block(new Pair(j, Y1), new Pair(j, Y1 + 1)));
                    }
                }

            }

            PriorityQueue<Integer> res = new PriorityQueue<>();
            for (int i = 1; i <= W; i++)
                for (int j = 1; j <= H; j++)
                    if (!V[i][j]) {
                        res.add(bfs(new Pair(i, j)));
                    }


            out.print(res.poll());
            while (!res.isEmpty())
                out.print(" " + res.poll());

            out.println();
        }

        int bfs(Pair P) {

            Queue<Pair> Q = new LinkedList<>();
            Q.add(P);
            int count = 1;
            V[P.X][P.Y] = true;

            while (!Q.isEmpty()) {

                P = Q.poll();

                int X = P.X, Y = P.Y;

                if (X - 1 > 0 && !B[X][Y][1] && !V[X - 1][Y]) {
                    V[X - 1][Y] = true;
                    Q.add(new Pair(X - 1, Y));
                    count++;
                }
                if (X + 1 <= W && !B[X][Y][3] && !V[X + 1][Y]) {
                    V[X + 1][Y] = true;
                    Q.add(new Pair(X + 1, Y));
                    count++;
                }
                if (Y - 1 > 0 && !B[X][Y][2] && !V[X][Y - 1]) {
                    V[X][Y - 1] = true;
                    Q.add(new Pair(X, Y - 1));
                    count++;
                }
                if (Y + 1 <= H && !B[X][Y][4] && !V[X][Y + 1]) {
                    V[X][Y + 1] = true;
                    Q.add(new Pair(X, Y + 1));
                    count++;
                }

            }

            return count;
        }

        boolean check(Pair P1, Pair P2) {
            if (P2.X < 1 || P2.X > W || P2.Y < 1 || P2.Y > H) return false;
            if (blocks.contains(new Block(P1, P2)) || blocks.contains(new Block(P2, P1))) return false;
            return true;
        }

        class Pair {
            int X, Y;

            Pair(int X, int Y) {
                this.X = X;
                this.Y = Y;
            }

            public String toString() {
                return X + " " + Y;
            }

            public boolean equals(Object o) {
                if (!(o instanceof Pair)) return false;
                return this.X == ((Pair) o).X && this.Y == ((Pair) o).Y;
            }
        }

        class Block {
            Pair P1, P2;

            Block(Pair P1, Pair P2) {
                this.P1 = P1;
                this.P2 = P2;
            }

            public String toString() {
                return P1 + " " + P2;
            }

            public boolean equals(Object o) {
                if (!(o instanceof Block)) return false;
                return this.P1.equals(((Block) o).P1) && this.P2.equals(((Block) o).P2);
            }
        }

        long gcd(long A, long B) {
            if (B == 0) return A;
            return gcd(B, A % B);
        }

        boolean isPrime(long n) {
            if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
                return false;
            for (long i = 5, j = 2; i * i <= n; i += j, j = 6 - j)
                if (n % i == 0)
                    return false;
            return true;
        }

        boolean isEqual(double A, double B) {
            return Math.abs(A - B) < eps;
        }

        double dist(double X1, double Y1, double X2, double Y2) {
            return Math.sqrt((X1 - X2) * (X1 - X2) + (Y1 - Y2) * (Y1 - Y2));
        }

        boolean nextPer(int[] data) {
            int i = data.length - 1;
            while (i > 0 && data[i] < data[i - 1]) {
                i--;
            }
            if (i == 0) {
                return false;
            }
            int j = data.length - 1;
            while (data[j] < data[i - 1]) {
                j--;
            }
            int temp = data[i - 1];
            data[i - 1] = data[j];
            data[j] = temp;
            Arrays.sort(data, i, data.length);
            return true;
        }

        long pow(long A, long B, long MOD) {
            if (B == 0) {
                return 1;
            }
            if (B == 1) {
                return A;
            }
            long val = pow(A, B / 2, MOD);
            if (B % 2 == 0) {
                return val * val % MOD;
            } else {
                return val * (val * A % MOD) % MOD;
            }
        }
    }

    private static class InputReader {
        StringTokenizer st;
        BufferedReader br;

        public InputReader(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public InputReader(FileReader s) throws FileNotFoundException {
            br = new BufferedReader(s);
        }

        public String next() {
            while (st == null || !st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            return st.nextToken();
        }

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

        public long nextLong() {
            return Long.parseLong(next());
        }

        public String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public boolean ready() {
            try {
                return br.ready();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}