program Black_or_White;

{ALEXANDRU SALCIANU -ROMANIA}

uses crt;

const max=5000;
type vector=array[1..max] of integer;
var a,e,c:vector;
    n,p,q,t:integer;
    changed:boolean;
    v:array[1..max,1..2] of integer;
    find:boolean;
    sel:array[1..max] of boolean;

procedure printing;
var i:integer;
begin
  writeln('YES');
  if changed then for i:=1 to n do a[i]:=-a[i];
  for i:=1 to n do write(a[i],' ');
  writeln;
end;

function inside(x:integer):boolean;
begin
  inside:=(x>0) and (x<=n);
end;

procedure mark(nr,father:integer);
begin
  if (not inside(nr)) or sel[nr] then exit;
  c[nr]:=father;
  sel[nr]:=true;
  mark(nr-p,father);
  mark(nr+p,father);
  mark(nr-q,father);
  mark(nr+q,father);
end;

procedure find_out;
var i,j,k,nrd,val1,val2,sum:integer;
begin
  for i:=1 to n do
    begin
      c[i]:=i;
      sel[i]:=false;
    end;
  for i:=1 to n do
    if c[i]=i then
                begin
                  sel[i]:=true;
                  mark(i+p,i);
                  mark(i-p,i);
                  mark(i+q,i);
                  mark(i-q,i);
                end;
  nrd:=0;
  for i:=1 to n do
    if c[i]=i then
                begin
                  v[i,1]:=0;
                  for j:=1 to p do
                    if c[j]=i then inc(v[i,1]);
                  v[i,2]:=0;
                  for j:=1 to q do
                    if c[j]=i then inc(v[i,2]);
                  inc(nrd);
                  e[nrd]:=i;
                end;
  if nrd=1 then begin find:=false; exit; end;
  for i:=1 to nrd-1 do
    for j:=i+1 to nrd do
      if v[e[i],1]*v[e[j],2]-v[e[i],2]*v[e[j],1]<>0
        then
          begin
            find:=true;
            val1:=v[e[j],2]+v[e[j],1];
            val2:=-(v[e[i],2]+v[e[i],1]);
            if v[i,1]*v[j,2]-v[i,2]*v[j,1]<0
              then
                begin
                  val1:=-val1;
                  val2:=-val2;
                end;
            for k:=1 to n do
              if c[k]=e[i] then a[k]:=val1
                           else if c[k]=e[j]
                                  then a[k]:=val2
                                  else a[k]:=0;
            for k:=1 to n-p+1 do
              begin
                sum:=0;
                for t:=k to k+p-1 do sum:=sum+a[t];
                if sum<=0 then find:=false;
              end;
            for k:=1 to n-q+1 do
              begin
                sum:=0;
                for t:=k to k+q-1 do sum:=sum+a[t];
                if sum>=0 then find:=false;
              end;
          end;
end;

begin
  clrscr;
  repeat
    write('n='); readln(n);
  until (n>0) and (n<max);
  repeat
    write('p='); readln(p);
  until p>0;
  repeat
    write('q='); readln(q);
  until q>0;
  if p>q then changed:=false
         else
           begin
             changed:=true;
             t:=p;
             p:=q;
             q:=t;
           end;
  if (p>n) or (q>n) or (p=q)
    then
      begin
        writeln('NO');
        writeln('Press ENTER to exit...');
        readln;
        exit;
      end;
  find:=false;
  find_out;
  if not find then writeln('NO')
              else printing;
  writeln('Press ENTER to exit...');
  readln
end.
