#!ruby -p n=eval$_ $_='RKR ' %w(N N Q B B).zip([7&c=' !"#'[n/96],c/8,n/16%6]+[n%4*2+1,n/2&6].sort){|s,i|$_[i,0]=s}