import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int n = sc.nextInt();
A[] array = new A[n];
for(int i=0 ;i<n ;i++){
array[i] = new A(sc.nextInt(),sc.nextInt