#include "testlib.h"
#include <algorithm>

const int maxt = 100;
const int maxd = 100;
const int maxn = 100;
const int maxr = 1000000;

int main()
{
  using std::min;
  using std::max;
  registerValidation();
  int t = inf.readInt(1, maxt);
  inf.readSpace();
  int d = inf.readInt(1, maxd);
  inf.readSpace();
  int n = inf.readInt(1, maxn);
  inf.readEoln();
  int cx1 = 0, cx2 = 0, cy1 = 0, cy2 = 0;
  for (int i = 0; i < n; i++)
  {
    int x = inf.readInt(-maxr, maxr);
    inf.readSpace();
    int y = inf.readInt(-maxr, maxr);
    inf.readEoln();
    cx1 -= t, cy1 -= t, cx2 += t, cy2 += t;
    cx1 = max(cx1, x + y - d), cx2 = min(cx2, x + y + d);
    cy1 = max(cy1, x - y - d), cy2 = min(cy2, x - y + d);
    if (cx1 > cx2 || cy1 > cy2)
      quitf(_fail, "No way! step=%d, time=%d, (x,y)=(%d,%d)", i, t * (i + 1), x, y);
  }
  inf.readEof();
  return 0;
}

