uses SysUtils;

var
 i,j,k,n,d: Integer;

begin
  if ParamCount<2 then
  begin
    writeln('Usage: rndtest <numpairs> <range>');
    exit;
  end;
  n := StrToInt(ParamStr(1));
  d := StrToInt(ParamStr(2));
  randomize;
  for k:=1 to n do 
  begin
    i := Random(d)+1; if random(100)<50 then i:=-i;
    j := Random(d)+1; if random(100)<50 then j:=-j;
    write('(');
    if i<0 then write('~');
    write('x',abs(i),' OR ');
    if j<0 then write('~');
    write('x',abs(j),')');
    if k<n then write(' AND ') else writeln;
  end;
end.
