while 1: n=input();s="RKR" for c,x in zip("NNQBB",[1030628>>n/96*2&3,18/(13-n/96)-1,n/16%6]+sorted([n%4*2+1,n/2&6])):s=s[:x]+c+s[x:] print s