#include <stdio.h>
int H, W, N, C, X[10], Y[10];
bool check(int x, int y)
{
int count_ = 0;
for(int i = 0; i < N; i++)
{
if(X[i] * y == Y[i] * x)
{
return false;
}
else if(X[i] * y > Y[i] * x)
{
count_++;
}
}
return count_ * 2 == N;
}
int main()
{
scanf("%d", &H);
scanf("%d", &W);
scanf("%d", &N);
for(int i = 0; i < N; i++)
{
scanf("%d", &X[i]);
scanf("%d", &Y[i]);
}
for(int i = 1; i < W; i++)
{
if(check(i, H))
{
printf("(%d,%d)\n", i, H); C++;
}
}
for(int i = 1; i <= H; i++)
{
if(check(W, i))
{
printf("(%d,%d)\n", W, i); C++;
}
}
if(!C)
{
printf("-1\n");
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgSCwgVywgTiwgQywgWFsxMF0sIFlbMTBdOwoKYm9vbCBjaGVjayhpbnQgeCwgaW50IHkpCnsKCWludCBjb3VudF8gPSAwOwoJCglmb3IoaW50IGkgPSAwOyBpIDwgTjsgaSsrKQoJewoJCWlmKFhbaV0gKiB5ID09IFlbaV0gKiB4KQoJCXsKCQkJcmV0dXJuIGZhbHNlOwoJCX0KCQllbHNlIGlmKFhbaV0gKiB5ID4gWVtpXSAqIHgpCgkJewoJCQljb3VudF8rKzsKCQl9Cgl9CgkKCXJldHVybiBjb3VudF8gKiAyID09IE47Cn0KCmludCBtYWluKCkKewoJc2NhbmYoIiVkIiwgJkgpOwoJc2NhbmYoIiVkIiwgJlcpOwoJc2NhbmYoIiVkIiwgJk4pOwoJCglmb3IoaW50IGkgPSAwOyBpIDwgTjsgaSsrKQoJewoJCXNjYW5mKCIlZCIsICZYW2ldKTsKCQlzY2FuZigiJWQiLCAmWVtpXSk7Cgl9CgkKCWZvcihpbnQgaSA9IDE7IGkgPCBXOyBpKyspCgl7CgkJaWYoY2hlY2soaSwgSCkpCgkJewoJCQlwcmludGYoIiglZCwlZClcbiIsIGksIEgpOyBDKys7CgkJfQoJfQoJCglmb3IoaW50IGkgPSAxOyBpIDw9IEg7IGkrKykKCXsKCQlpZihjaGVjayhXLCBpKSkKCQl7CgkJCXByaW50ZigiKCVkLCVkKVxuIiwgVywgaSk7IEMrKzsKCQl9Cgl9CgkKCWlmKCFDKQoJewoJCXByaW50ZigiLTFcbiIpOwoJfQoJCglyZXR1cm4gMDsKfQ==