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

using namespace std;

vector <pair <int, int> > readAnswer( InStream &in, TResult result )
{
  int n = in.readInt();
  vector <pair <int, int> > res;
  for (int i = 0; i < n; i++)
  {
    int x = in.readInt();
    int y = in.readInt();
    res.push_back(make_pair(x, y));
  }
  sort(res.begin(), res.end());
  for (int i = 1; i < (int)res.size(); i++)
    if (res[i] == res[i - 1])
      quitf(result, "duplicate point (%d,%d)", res[i].first, res[i].second);
  return res;
}

int main( int argc, char **argv )
{
  setName("checker for problem “manhattan” from russia-team-2009 contest");
  registerTestlibCmd(argc, argv);
  vector <pair <int, int> > ja = readAnswer(ans, _fail);
  vector <pair <int, int> > pa = readAnswer(ouf, _pe);
  for (int i = 0; i < (int)ja.size() || i < (int)pa.size(); i++)
  {
    if (i < (int)ja.size() && i < (int)pa.size() && ja[i] == pa[i])
      continue;
    if (i >= (int)ja.size() || (i < (int)pa.size() && ja[i] > pa[i]))
      quitf(_wa, "contestant found extra point: (%d, %d)", pa[i].first, pa[i].second);
    if (i >= (int)pa.size() || (i < (int)ja.size() && ja[i] < pa[i]))
      quitf(_wa, "contestant didn't found point: (%d, %d)", ja[i].first, ja[i].second);
    quitf(_fail, "No way. May be velociraptors from Mars are attaking us?");
  }
  quitf(_ok, "[points: %d]", ja.size());
}

