function nextrow(v)
   return [1] cat [v[i]+v[i+1] : i in [1..#v-1]] cat [1];
end function;

function mod4(v)
   return [Integers(4)!a : a in v];
end function;

procedure pnum(v)
   cols := ["B", "K", "G", "W"];
   for x in v do 
      printf "%o ",cols[(x mod 4) +1];
   end for;
end procedure;
