function curse2(n)
for ii = 1:n
   fprintf('A %d %d\n', n, ii)
   curse2(n/2)
   fprintf('B %d %d\n', n, ii)
end


