You can't. D = S ^ B ^ R
, given D and R, you can get S ^ B
back (as you showed), but the rest of the information is just gone.
Of course it had to be gone: you have only 8 bits, you can't store 12 bits of information in there. If you could, you could recursively apply that transformation until you've compressed any arbitrary amount of information down to a single byte.
But, maybe you have some a-priory knowledge about S and B, or some useful relation between them or between one of them and R. If you have enough of that knowledge, you might be able to reconstruct S and B (for example, if B = R, then D = S so you know them all).