uses
  SysUtils, testlib, Math;

type
  tpoint = record
    px, qx, py, qy : extended;
  end;
  tline = record
    a, b, c : extended;
  end;

const maxn = 2000;
eps = 1e-9;

var
  maxx : extended;
  n, i, num : longint;
  x, y : array[1..maxn] of longint;
  u : array[1..maxn] of integer;

function equal(p1, p2 : tpoint) : boolean;
begin
  result := (p1.px = p2.px) and (p1.qx = p2.qx) and (p1.py = p2.py) and (p1.qy = p2.qy);
end;

function gcd(a, b : int64) : int64;
var
  t : int64;
begin
  a := abs(a);
  b := abs(b);
  while (a <> 0) do begin
    t := b mod a;
    b := a;
    a := t;
  end;
  result := b;
end;

function getLine(x1, y1, x2, y2 : int64) : tline;
begin
  result.a := y2 - y1;
  result.b := x1 - x2;
  result.c := -result.a * x1 - result.b * y1;
end;

function middleLine(l : tline; x1, y1, x2, y2 : int64) : tline;
var
  d1, d2 : extended;
begin
  result.a := -l.b;
  result.b := l.a;
  d1 := result.a * x1 + result.b * y1;
  d2 := result.a * x2 + result.b * y2;
  result.a := result.a * 2;
  result.b := result.b * 2;
  result.c := -d1 - d2;
end;

function middleL(x1, y1, x2, y2 : int64) : tline;
begin
  result.a := x1 - x2;
  result.b := y1 - y2;
  result.c := result.a * (x1 + x2) + result.b * (y1 + y2);
  result.a := result.a * 2;
  result.b := result.b * 2;
end;

function inter(l1, l2 : tline) : tpoint;
var
  t, x, y, g1, g2 : extended;
begin
  t := l1.a * l2.b - l1.b * l2.a;
  x := l2.c * l1.b - l1.c * l2.b;
  y := -l2.c * l1.a + l1.c * l2.a;

  maxx := max(maxx, t);
  maxx := max(maxx, x);
  maxx := max(maxx, y);

  if (t = 0) then
    quit(_wa, 'Three points are on the same line');

  g1 := gcd(round(t), round(x));
  g2 := gcd(round(t), round(y));
  if (g1 <> 0) then begin
    result.px := floor(x / g1);
    result.qx := floor(t / g1);
  end else begin
    result.px := 0;
    result.qx := 1;
  end;
  if (result.qx < 0) then begin
    result.px := -result.px;
    result.qx := -result.qx;
  end;

  if (g2 <> 0) then begin
    result.py := floor(y / g2);
    result.qy := floor(t / g2);
  end else begin
    result.py := 0;
    result.qy := 1;
  end;
  if (result.qy < 0) then begin
    result.py := -result.py;
    result.qy := -result.qy;
  end;
end;

procedure check(state : integer);
var
  cnt, i : longint;
  ind : array[1..3] of longint;
  l1, l2, ll : tline;
  p, pp : tpoint;
begin
  cnt := 0;
  for i := 1 to n do begin
    if ((u[i] and state) <> 0) then begin
      cnt := cnt + 1;
      ind[cnt] := i;
      if (cnt = 3) then
        break;
    end;
  end;
  if (cnt = 0) then
    quit(_wa, 'No points on circle number: ' + IntToStr(state)); 
  if (cnt < 3) then
    exit;

  l1 := getLine(x[ind[1]], y[ind[1]], x[ind[2]], y[ind[2]]);
  l1 := middleLine(l1, x[ind[1]], y[ind[1]], x[ind[2]], y[ind[2]]);
  l2 := getLine(x[ind[1]], y[ind[1]], x[ind[3]], y[ind[3]]);
  l2 := middleLine(l2, x[ind[1]], y[ind[1]], x[ind[3]], y[ind[3]]);

  p := inter(l1, l2);

  if (p.qx = 0) then
    quit(_wa, 'Three points are on the same line');

  cnt := 0;
  for i := 1 to n do begin
    if ((u[i] and state) <> 0) then begin
      cnt := cnt + 1;
      if (cnt > 3) then begin
        ll := getLine(x[ind[1]], y[ind[1]], x[i], y[i]);
        ll := middleLine(ll, x[ind[1]], y[ind[1]], x[i], y[i]);
        pp := inter(l1, ll);
        if not(equal(p, pp)) then begin
//          writeln(erroutput, maxx);
          quit(_wa, format('Points: %d, %d, %d, %d are not on the same circle', [ind[1], ind[2], ind[3], i]));
        end;
      end;
    end else begin
      ll := getLine(x[ind[1]], y[ind[1]], x[i], y[i]);
      ll := middleLine(ll, x[ind[1]], y[ind[1]], x[i], y[i]);
      pp := inter(l1, ll);
      if (equal(p, pp)) then
        quit(_wa, format('Point number %d lies on circle number %d, but does not appear in the list', [i, state]));
    end;
  end;
end;

begin
  n := inf.readlongint;
  for i := 1 to n do begin
    x[i] := inf.readlongint;
    y[i] := inf.readlongint;
  end;

  while not(ouf.seekeoln) do begin
    num := ouf.readlongint;
    if (num < 1) or (num > n) then
      quit(_wa, 'Wrong number of point: ' + IntToStr(num));
    if (u[num] and 1) <> 0 then
      quit(_wa, 'Duplicate points: ' + IntToStr(num));
    u[num] := u[num] + 1;
  end;

  ouf.nextline;

  while not(ouf.seekeoln) do begin
    num := ouf.readlongint;
    if (num < 1) or (num > n) then
      quit(_wa, 'Wrong number of point: ' + IntToStr(num));
    if (u[num] and 2) <> 0 then
      quit(_wa, 'Duplicate points: ' + IntToStr(num));
    u[num] := u[num] + 2;
  end;

  for i := 1 to n do begin
    if (u[i] = 0) then
      quit(_wa, 'Point number ' + IntToStr(i) + ' does not appear in lists');
  end;

  maxx := 0;
  check(1);
  check(2);
//  writeln(erroutput, maxx);

  quit(_ok, 'Ok');
end.