import java.util.*; import java.io.*; public class Main{ static final Reader sc = new Reader(); static final PrintWriter out = new PrintWriter(System.out,false); public static void main(String[] args) throws Exception { int w = sc.nextInt(); int h = sc.nextInt(); int n = sc.nextInt(); int[] s = new int[n]; int[] k = new int[n]; long[][] card = new long[w][h]; for(int i=0;i