uses
  testlib, SysUtils;

const
  MAXN = 100;

var
  n, jm, pm, a, b, i, j : integer;
  tab : array[1..MAXN, 1..MAXN] of boolean;
  u : array[1..MAXN] of boolean;

function dfs(a, b : integer) : boolean;
var
  j : integer;
begin
  u[a] := true;
  if (a = b) then begin
    result := true;
    exit;
  end;
  for j := 1 to n do begin
    if (tab[a][j]) and not(u[j]) then begin
      if (dfs(j, b)) then begin
        result := true;
        exit;
      end;
    end;
  end;
  result := false;
end;

function proofed(a, b : integer) : boolean;
var
  i : integer;
begin
  for i := 1 to n do begin
    u[i] := false;
  end;
  result := dfs(a, b);
end;

procedure add(a, b : integer);
begin
  tab[a][b] := true;
end;

begin
  n := inf.readlongint;
  jm := ans.readlongint;
  pm := ouf.readlongint;
  if (pm < jm) then
    quit(_wa, 'Expected: ' + IntToStr(jm) + ', found: ' + IntToStr(pm));
  if (pm > n * n) then
    quit(_wa, 'Too much proofs');
  for i := 1 to n do begin
    for j := 1 to n do begin
      tab[i][j] := false;
    end;
  end;
  for i := 1 to pm do begin
    a := ouf.readlongint;
    b := ouf.readlongint;
    if (a < 1) or (a > n) then
    	quit(_wa, 'Wrong number of definition: ' + IntToStr(a));
    if (b < 1) or (b > n) then
    	quit(_wa, 'Wrong number of definition: ' + IntToStr(b));
    if (proofed(a, b)) then
      quit(_wa, 'Consequence from ' + IntToStr(a) + ' to ' + IntToStr(b) + ' is already proofed') ;
    add(a, b);
  end;
  if (pm > jm) then
    quit(_fail, 'Contestant found better solution');
  quit(_ok, 'OK');
end.