#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string.h>
#include<string>
#include<stdlib.h>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<set>
using namespace std;
// Define Some Variables
#define eps 1e-14
#define si 100010
#define pi acos(-1.0)
#define inf (1<<30)-1
#define mod 1000000000 //10^9
//Define Some Functions
#define even(a) ((a)%2==0)
#define odd(a) ((a)%2==1)
#define max(a,b) (a>b ?a:b)
#define min(a,b) (a<b ?a:b)
#define pb push_back
#define mpair make_pair
#define sqr(a)((a)*(a))
#define area(x1,y1,x2,y2,x3,y3) (x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)) //Area of a triangle
#define dist(x1,y1,x2,y2) (sqr(x1-x2)+sqr(y1-y2)) //Distance between two points
#define mem(a,v) memset(a,v,sizeof(a))
inline bool compare( double a, double b ) { return fabs( a-b ) < eps ; }
#define fr(i,a,b) for(i=a;i<=b;i++)
#define rep(i,a,b) for(i=a;i<b;i++)
#define rev(i,a,b) for(i=a;i>=b;i--)
//typedef __int64 i64;
typedef long long i64;
int i,j,l,n,cs=1,cnt,sm,fg,a[si];
map<pair<int,int>,int>mp;
struct ss
{
int x,y;
}stru[si];
bool cmp(ss aa,ss bb)
{
if(aa.x==bb.x)
return aa.y>bb.y;
return aa.x<bb.x;
}
int main()
{
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int m,p,u,v,on,mm,nw,nxt;
scanf("%d%d%d",&n,&m,&p);
//while(~)
//{
for(i=0;i<p;i++)
{
scanf("%d%d",&stru[i].x,&stru[i].y);
mp[make_pair(stru[i].x,stru[i].y)]++;
}
for(i=1;i<=n;i++)
a[i]=0;
sort(stru,stru+p,cmp);
for(i=0;i<p;i++)
{
nw=mp[make_pair(stru[i].x,stru[i].y)];
nxt=mp[make_pair(stru[i].x,(stru[i].y+1))];
if(nw>(nxt+1)&&stru[i].y<m)
a[stru[i].x]=-1;
}
for(i=1;i<=n;i++)
{
if(a[i]<0)
{
printf("-1\n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SxzdHJ1K3AsY21wKTsKICAgICAgICBmb3IoaT0wO2k8cDtpKyspCiAgICAgICAgewogICAgICAgICAgICBudz1tcFttYWtlX3BhaXIoc3RydVtpXS54LHN0cnVbaV0ueSldOwogICAgICAgICAgICBueHQ9bXBbbWFrZV9wYWlyKHN0cnVbaV0ueCwoc3RydVtpXS55KzEpKV07CiAgICAgICAgICAgIGlmKG53PihueHQrMSkmJnN0cnVbaV0ueTxtKQogICAgICAgICAgICBhW3N0cnVbaV0ueF09LTE7CiAgICAgICAgfQoKCQlmb3IoaT0xO2k8PW47aSsrKQoJCXsKCQkgICAgaWYoYVtpXTwwKQoJCSAgICB7CgkJICAgICAgICBwcmludGYoIi0xXG4iKTsKCQkgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICB9CgkJICAgIHNtPW0tMTsKICAgICAgICAgICAgb249bXBbbWFrZV9wYWlyKGksMSldOwogICAgICAgICAgICBtbT1tcFttYWtlX3BhaXIoaSxtKV07CiAgICAgICAgICAgIHNtKz0obW0tb24pOwoKCQkgICAgcHJpbnRmKCIlZFxuIixzbSk7CgkJfQoJCW1wLmNsZWFyKCk7CiAgICAvL30KICAgCXJldHVybiAwOwp9Cg==